Skip to content

Commit 5ef01cb

Browse files
De-contoso-ify the SCER demo
1 parent 396a2d5 commit 5ef01cb

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

scoped-custom-element-registries/index.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@
5151
<h1>Scoped custom element registries Demo</h1>
5252

5353
<section class="intro">
54-
<p>This page uses two <code>&lt;contoso-button&gt;</code> custom elements, which are defined in two separate scoped custom element registries.<br>
54+
<p>This page uses two <code>&lt;my-button&gt;</code> custom elements, which are defined in two separate scoped custom element registries.<br>
5555
Without scoped registries, the second definition would throw an error. With scoped registries, both coexist peacefully.</p>
5656

5757
<strong>What's happening:</strong>
5858

5959
<ul>
6060
<li>Two separate scoped registries are created using <code>new CustomElementRegistry()</code>.</li>
6161
<li>Each registry is <em>scoped</em> to a different DOM element via the <code>customElementRegistry</code> option.</li>
62-
<li>Two <code>&lt;contoso-button&gt;</code> elements are created, one in each DOM element, and using different custom element definitions.</li>
62+
<li>Two <code>&lt;my-button&gt;</code> elements are created, one in each DOM element, and using different custom element definitions.</li>
6363
<li><strong>No naming conflicts.</strong> The same tag name has completely different behaviors in different scopes.</li>
6464
</ul>
6565
</section>
@@ -134,7 +134,7 @@ <h1>Scoped custom element registries Demo</h1>
134134
const confettiManager = new CanvasConfettiManager();
135135

136136
// Custom Element Definition: Fancy Button from Cool Library.
137-
class ContosoComponentLibV1Button extends HTMLElement {
137+
class MyComponentLibV1Button extends HTMLElement {
138138
nbOfConfettis = 10;
139139
velocityBase = 3;
140140
velocityRandom = 2;
@@ -172,7 +172,7 @@ <h1>Scoped custom element registries Demo</h1>
172172
}
173173
}
174174
</style>
175-
<button>Contoso button V1</button>
175+
<button>My button V1</button>
176176
`;
177177

178178
const button = this.querySelector('button');
@@ -220,7 +220,7 @@ <h1>Scoped custom element registries Demo</h1>
220220
}
221221

222222
// Custom Element Definition: Fancy Button from Wave Library.
223-
class ContosoComponentLibraryV2Button extends HTMLElement {
223+
class MyComponentLibraryV2Button extends HTMLElement {
224224
nbOfConfettis = 100;
225225
angleVariation = 0.5;
226226
velocityBase = 4;
@@ -264,7 +264,7 @@ <h1>Scoped custom element registries Demo</h1>
264264
}
265265
}
266266
</style>
267-
<button>Contoso button V2 ✨</button>
267+
<button>My button V2 ✨</button>
268268
`;
269269

270270
const button = this.querySelector('button');
@@ -339,22 +339,22 @@ <h1>Scoped custom element registries Demo</h1>
339339
try {
340340
// Create two registries, one for each custom element.
341341
const registryForV1 = new CustomElementRegistry();
342-
registryForV1.define('contoso-button', ContosoComponentLibV1Button);
342+
registryForV1.define('my-button', MyComponentLibV1Button);
343343

344344
const registryForV2 = new CustomElementRegistry();
345-
registryForV2.define('contoso-button', ContosoComponentLibraryV2Button);
345+
registryForV2.define('my-button', MyComponentLibraryV2Button);
346346

347347
// Create instances of the custom elements, specifying the registry to use for each.
348-
const ContosoComponentLibV1ButtonElement = document.createElement('contoso-button', {
348+
const MyComponentLibV1ButtonElement = document.createElement('my-button', {
349349
customElementRegistry: registryForV1
350350
});
351-
const ContosoComponentLibraryV2ButtonElement = document.createElement('contoso-button', {
351+
const MyComponentLibraryV2ButtonElement = document.createElement('my-button', {
352352
customElementRegistry: registryForV2
353353
});
354354

355355
// Append the elements to the DOM.
356-
document.getElementById('cool-button-container').appendChild(ContosoComponentLibV1ButtonElement);
357-
document.getElementById('wave-button-container').appendChild(ContosoComponentLibraryV2ButtonElement);
356+
document.getElementById('cool-button-container').appendChild(MyComponentLibV1ButtonElement);
357+
document.getElementById('wave-button-container').appendChild(MyComponentLibraryV2ButtonElement);
358358
} catch (error) {
359359
const message = "Your browser doesn't support scoped custom element registries yet 😢. If you need this feature, add a thumbs up 👍 reaction to <a href='https://github.com/web-platform-dx/developer-signals/issues/364'>this issue</a>.";
360360
document.querySelector(".demo").innerHTML = `<p>${message}</p>`;

0 commit comments

Comments
 (0)