-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upstream Shadow DOM spec to DOM/HTML Standard #377
Comments
I took a quick look.
We should check with @annevk, but I would be OK with gradually moving over pieces, leaving pointers from the current spec into their new destinations. The trick is figuring out what are good chunks of work to do that in. For example, we could move over the HTMLSlotElement and assignedSlot stuff in one chunk and have it reference the shadow DOM spec until it's fully integrated. We could move over the conceptual stuff in another chunk. Etc. |
I think a good place to start would be the "in a document" versus "in a x document" checks in the HTML standard. That is once the pieces that is actually biting implementers. I forgot what we decided on for x. I think it's a good idea to do things in pieces. |
As far as I know, for x, there are several candidates:
However, in #362, I proposed connectedToDocument / disconnectedFromDocument. The pros of e.g.
But if we use e.g.
|
Isn't the problem with "deep" that if you have a closed shadow tree those nodes would be excluded, as is the case with |
So far, I do not feel any trouble by using the term of "deep" in the Shadow DOM spec. When I have to consider a closed shadow tree, I am using "unclosed node" or "unclosed tree" in defining the behavior of a closed tree. That seems successful, so far. I do not have any trouble. "composed" might be confusing because the Shadow DOM spec has a well defined concept of "composed tree". "in a document deeply" and "in a composed tree" are different concept. But, I am fine with using composed here because it sounds more intuitive, I think. Thus, the candidates would be:
|
So you are saying that I don't understand what the conceptual difference would be between "composed document" and "deep document" if deep document was not restricted to unclosed nodes. Which nodes would be in the former that are not in the latter? Or vice versa? |
Sorry for confusing.
Basically, yes. (Though the spec does not use the term of "deep document")
I am thinking that we can replace existing terms with more understandable terms:
Note that "deepPath()" is only web-exposed API which uses the term of "deep". I am not sure how we should rename this or keep this as is. |
My thinking with respect to the "deep" terminology was that it would be exactly like "composed", but restricted to "unclosed" nodes. So most standards would operate on "composed documents", but APIs would be restricted to either "documents" or "deep documents", depending on the use case. There was also the case of nodes that would not end up in the composed tree and how to address them. I don't think we had a solution for that. |
How about "in a connected tree scope" where "tree scope" refers to either a Document or a shadow root which is a node's ancestor, and "connected" means the tree scope is either a document or its host is "in a connected tree scope". |
I'm okay to use the deep terminology in this sense. But the current Shadow DOM spec does not follow this rule, e.g. "deep child": http://w3c.github.io/webcomponents/spec/shadow/#dfn-deep-child If we reserve the "deep" terminology for this purpose, "deep child" or other similar terminologies should bee renamed to something, such as "composed child" ?
I am fine with this idea, basically. From my experience, most standards could operate on "a composed document". It's rare case that APIs would be restricted to "deep documents".
"in a composed document, but not in a document composed tree" could work, I think. It this is too long, we have to invent yet another terminology as an alias for this long condition. |
@hayatoito yeah, "deep child" would have to become "composed child". @rniwa is "connected" a replacement term for "composed" or "deep" (with "deep" meaning "composed" excluding "closed")? |
"connected" would mean it's in the document or your shadow root's host is in the document regardless of whether any of shadow root inside which you reside is closed or not. So I think it corresponds to "composed" in your terminology. |
If we can agree that we use "in a composed document", let me do a batch internal renaming refactoring in the Shadow DOM spec as follows:
This internal renaming does not affect any web-facing APIs. I prefer "in a composed document" because it is short, relatively. "Shortness" is good here because it is expected that the term would appear in many places. Does it sound good? |
- Rename the terminologies as follows: - deep XXX => composed XXX - tree of trees => composed tree of component trees - composed tree => flat tree - composition => flattening - In a document deeply => in a composed document - Introduce a *composed document* as an alias for "a tree of trees whose root tree is a document tree" This internal renaming does not have any affect on web-facing APIs.
Renaming was done at 9b7f16e |
I want to start working on #57. My tentative plan is:
This will shift some of the development work of Shadow DOM elsewhere, but I think that's okay, since it mostly affects features defined elsewhere. Not too different from the collaboration between Service workers, Fetch, and HTML, or HTML and JavaScript, etc. I will copy @hayatoito for review. Anyone else who wants to tag along let me know. We could perhaps create a GitHub team called "shadow" that we tag on any such issues and PRs, if that's needed. |
Sounds great. I would appreciate if you could work on this. I'm totally fine with shifting the development elsewhere. |
@hayatoito so another thing here what would help is updating the Shadow DOM specification to build on concepts established elsewhere. E.g., now DOM has "get the parent", Shadow DOM could use this to define the event path. Other extensions to event dispatching could also be made a little bit more explicit and such. Is this something you plan on doing or are you hoping that will be taken care of during migration? It seems to me we could do it during migration, but there'll be a lot of changes then. |
Sure. I am happy to update the Shadow DOM spec so that it will use an established new concept as much as possible even if we are in the migration period. Please feel free to file an issue, e.g. "Use get the parent in a shadow spec", or ping me if you are introducing a new concept in your commits. I would like to get notified somehow. |
I've started adding some shadow-related concepts in DOM by the way: |
@domenic @hayatoito do you think the best approach for slots is that DOM defines a concept of a slot element and HTML says that |
My plan is to figure out slots first, including how the HTML parser needs to change, etc., and only then take over event handling. Slots are important for events, so that seems like the best way to do this incrementally. |
Sounds good to me. An event, especially get the parent algorithm for Node, is only the consumer of slots in DOM Standard, I guess. |
That plan sounds good to me, kind of like how DOM takes care of some of the |
I had added language for slots to the DOM Standard. Next is figuring out the superglobal Am I overlooking anything? |
Looks good to me. A nice simplification. |
At some point we should start removing stuff from http://w3c.github.io/webcomponents/spec/shadow/ and pointing those sections to DOM/HTML. |
Yeah, I have already started to remove some concepts from the Shadow DOM spec and started to use the newly defined concepts in DOM Standard, though, the spec is not always up-to-date. Let me clean up the spec periodically. |
Domenic, Hayato, please hold off removing stuff from the specs. W3C has been working for some time to try and make its specs more modular instead of more monolithic, so the question is now in front of the Working Group. |
Chaals, these specs cannot be more modular; they are deeply intrusive into the existing standards and exist largely as monkeypatches. It's important to get them into their proper contexts. This has always been the goal of web components; template was the first success, and custom elements and shadow DOM are following its footsteps. |
Notable changes: - Implemented HTMLElement constructor using @rniwa's algorithm from #403. - Rewrote element upgrading to use @rniwa's algorithm from #403, and incorporated it into the rest of the upgrading considerations. - Got rid of the ability to extend SVGElement, thus allowing us to remove most mentions of namespaces from the spec. - Removed createdCallback. - Rewrote "registering elements": - Uses defineElement instead of registerElement - Preserves the constructor instead of grabbing the .prototype property and synthesizing a new constructor - No longer spread out over four separate algorithms plus registerElement; everything is now inline under defineElement - More precise about exactly how to get the custom element prototype and callbacks - Rewrote createElement and createElementNS to be replacements instead of patches, and to call the author-supplied constructor. - Removed the "All Algorithms in One Diagram" section since so many algorithms changed or were inlined into their callers. - Removed the "Custom Elements and ECMAScript 6" section since it is very obsolete and does not reflect our current thinking. - New and rewritten algorithms do not use the unorthodox INPUTS/OUTPUTS blocks, or capitalized variable names. This is kind of a nice marker of new vs. old content. - I have taken over as spec editor for custom elements Notable things *not* substantially changed: - Parser changes are not specced still, besides to say that they should construct the element using its constructor. - Lifecycle callbacks were not changed, except for removing createdCallback. - Type extensions were not removed (yet?); it seems better to have a modernized version of them that we atomically remove. - Registries were not made available everywhere. Closes #403. Closes #365. Closes #283. Closes #185. Closes #170. Closes #169. Closes #167. Closes #163. Closes #162. Closes #161. Closes #158. Closes #137 (modulo the fact that #165 is still open). Closes #134. Closes #133.
I've started making the necessary changes to HTML's algorithms to account for shadow trees by the way. Easiest way to stay informed is following https://github.com/whatwg/html as there are many changes necessary and landing them all in one go does not really seem feasible, at least not without lots of rebasing that I'm not particularly keen on (and it would make reviewing a pain too). |
The status of upstreaming:
I could not spend much time on maintaining Shadow DOM specification recently. |
The status update:
The remainings are Section 6, 7 and 8. |
Let me clarify my upstreaming plan: I am trying to upstream Shadow DOM into DOM/HTML to confirm that it can be integrated with DOM/HTML properly. The reason I could not maintain W3C Shadow DOM specification to reflect the latest change which is happening in DOM/HTML Standard is my bandwidth and its difficulty. It is difficult to pick up necessary parts nicely with a clear separation. Let me try to spend my time on it, but I would also welcome contributions. If someone could work on downstreaming to W3C Shadow DOM specification from DOM/HTML Standard, it would be greatly appreciated. I'm afraid that we have to copy almost all of "3. Events" and "4. Nodes" section, as is, from https://dom.spec.whatwg.org/, at least. |
Why would we maintain a copy? That seems way confusing. |
Hey @annevk: It might be confusing, but such is the price of peace! We (the Chrome team) feel deeply grateful to our colleagues at Microsoft (and other places) who have worked with all of us to keep Web Components on track. Part of the agreement that has allowed them to participate is that we maintain a version of this spec which can be run through the W3C process inside of WPWG. That means we'll carry the patch. More work, perhaps confusing, but necessary. Thanks for understanding. |
- Replace "2. Composition" and "3. Distributions" with "DOM: 4.2.2 Shadow Tree". - Remove "4. Flattening" since it is already defined in CSS Scoping. - Replace "5. Events" with "DOM: 3.8 Dispatching Events".
@hayatoito do you have a pointer for the Touch Events work as I don't find anything about shadow trees in https://w3c.github.io/touch-events/? Same for UI Events actually, nothing about shadow trees in https://w3c.github.io/uievents/. I'm also missing a pointer to w3c/DOM-Parsing#21 for https://github.com/whatwg/html/labels/topic%3A%20shadow is another list of outstanding issues. Should we perhaps create a new tracking issue for all these items so we have a clean slate for all upstream work? |
Regarding TouchEvents, it looks what I have done is to make TouchEvents 'composed' events, and add event retargeting process. Regarding UIEvents, it looks what I have done is to make some UIEvents 'composed' events. Hmm, I forgot to add retargeting process there. :( Regarding w3c/DOM-Parsing#21, this was not fixed. I remember that we had a discussion about whether we should add innerHTML to DocumentFragment, rather than ShadowRoot, or not. However, I guess that was not solved due to the lack of follow-up.
Yes, that would be great. Recently, I couldn't spend much time on upstreaming tasks. Please feel free to create a new tracking issue. |
We decided not to do this, since |
Closing in favor of #661. |
Eventually, we should upstream Shadow DOM spec into DOM/HTML Standard.
Let's use this issue to discuss how we should proceed. That might not happen soon, but I hope we can start in the near future.
The text was updated successfully, but these errors were encountered: