Add comment

This commit is contained in:
Konnor Rogers
2024-06-19 16:56:20 -04:00
parent 82fb3dd5ef
commit facf552597

View File

@@ -106,6 +106,8 @@ export default class ShoelaceElement extends LitElement {
if (!currentlyRegisteredConstructor) {
// We try to register as the actual class first. If for some reason that fails, we fall back to anonymous classes.
// customElements can only have 1 class of the same "object id" per registry, so that is why the try {} catch {} exists.
// Some tools like Jest Snapshots and if you import the constructor and call `new SlButton()` they will fail with
// the anonymous class version.
try {
customElements.define(name, elementConstructor, options);
} catch (_err) {