- From: Justin Fagnani <notifications@github.com>
- Date: Tue, 25 Feb 2020 10:09:51 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 25 February 2020 18:10:04 UTC
justinfagnani commented on this pull request. > +export class MyElement extends HTMLElement { + constructor() { + this.attachShadow({mode: 'open', registry}); + } +} +``` + +### Scoped element creation APIs + +Element creation APIs, like `createElement()` and `innerHTML` can be grouped into global API (those on Document or Window) and scoped APIs (those on HTMLElement and ShadowRoot). The scoped APIs have an associated Node that can be used to look up a CustomElementRegistry and thus a scoped definition. + +In order to support scoped registries we add new scoped APIs, that were previously only available on `Document`, to `ShadowRoot`: + +* `createElement()` +* `createElementNS()` +* `importNode()` `adoptNode` doesn't create nodes or run upgrade steps (https://dom.spec.whatwg.org/#concept-node-adopt) so it doesn't need to find a registry. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/webcomponents/pull/865#discussion_r384021634
Received on Tuesday, 25 February 2020 18:10:04 UTC