[scoped-registries] Describe interaction with declarative shadow DOM#915
[scoped-registries] Describe interaction with declarative shadow DOM#915justinfagnani wants to merge 3 commits into
Conversation
c777785 to
8ef6f9f
Compare
|
@rniwa @mfreed7 I updated this PR with what we resolved from last weeks meeting, by adding Can one of you review? Thanks! |
|
|
||
| The shadow root created by this HTML will have a `null` registry, and be in a "awaiting scoped registry" state that allows the registry to be set once after creation. | ||
|
|
||
| To identify this "no registry, but awaiting one" state, ShadowRoot will have a `scopedRegistry` boolean property. `scopedRegistry` will set to `true` for all ShadowRoots with a scoped registry, or awaiting a scoped registry. Code can tell that ShadowRoot has an assignable `registry` property if `root.registry === null && root.scopedRegistry === true`. |
There was a problem hiding this comment.
We should probably have "shadowRoot.customElements" instead of "shadowRoot.scopedRegistry" to be consistent with the global registry.
There was a problem hiding this comment.
I think that would be shadowRoot.customElements instead of shadwoRoot.registry?
There was a problem hiding this comment.
Hmm, I find shadowRoot.customElements a bit harder to understand, as it's defined. In other words, this boolean is true "when the shadowRoot has a scoped registry, or is waiting for a scoped registry". I feel like "registry" should be at least somewhere in the name of the property, right?
There was a problem hiding this comment.
@rniwa meant that registry should be named customElements to match the global window.customElements.
shadowRoot.scopedRegistry would still be the boolean, if that's agreeable. (I don't think we do is or has prefixes in the DOM, correct?)
There was a problem hiding this comment.
Oh! Thanks, I missed that. I agree with renaming shadowRoot.registry to shadowRoot.customElements, which is exactly what you both wrote, but I failed to read correctly.
The DOM does use is sometimes, e.g. isConnected, isTrusted, isMap, isContentEditable, etc. The has prefix (which seems like what we'd want here) is also used, though less so. For example, hasBeenActive. If has is acceptable, I'd definitely lobby for renaming shadowRoot.scopedRegistry to shadowRoot.hasScopedRegistry.
There was a problem hiding this comment.
I'll change to hasScopedRegistry in this PR and we can see what other reviewers think.
As for registry vs customElements: that effects the argument to attachShadow() too. I think I should make a separate PR for both so the change is more obvious?
|
What is the status of this WRT the latest scope registry implementations in Chromium and WebKit? Is I'm playing around with things now, and since server rendering with DSD is an important strategy for me, I'm trying to understand how best to integrate that with scoped registries, given the recent progress in browser engines. |
There is no support yet. We need to solidify the proposal to figure out what exactly we're gonna do here. |
|
This issue is obsolete now that we've merged scooped custom element registry definitions into DOM & HTML specifications. |
Fixes #914
This adds a
shadowrootregistryattribute for<template shadowrootmode>andShadowRoot.prototype.scopedRegistry, as discussed in the String 2023 F2F meeting.