Re: [WICG/webcomponents] [scoped-registries] Interaction with HTML element's overridden constructor steps (Issue #969)

Unfortunately I found a case where my approach doesn't work...

It uses a constructor that re-enters itself with a direct call, and it's registered to different registries with different names:
```javascript
let nestedCalled = false;
let createdByNestedCall;
class ReentryByDirectCall extends HTMLElement {
  constructor() {
    super();
    if (!nestedCalled) {
      nestedCalled = true;
      createdByNestedCall = new ReentryByDirectCall;
    }
  }
}
window.customElements.define('test-element', ReentryByDirectCall);

let registry = new CustomElementRegistry;
registry.define('shadow-test-element', ReentryByDirectCall);
let shadow = host.attachShadow({mode: 'open', registry});
```

Then if we call `shadow.createElement('shadow-test-element')`, we are supposed to also create `createdByNestedCall` using the global registry, and hence set its local name to `test-element`.

However, with the approach, we just check the tag on the constructor, and ended up using the scoped registry and creating another `shadow-test-element`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/969#issuecomment-1396352059
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/969/1396352059@github.com>

Received on Thursday, 19 January 2023 02:11:07 UTC