Skip to content
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

Editorial: explain the possible primary interfaces for nodes #1279

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

domenic
Copy link
Member

@domenic domenic commented Apr 18, 2024

I was trying to check whether a switch statement was exhaustive and had to do a bit of mental juggling to get there. I thought I'd write out the results for future reference.


Preview | Diff

dom.bs Outdated
@@ -2252,6 +2252,10 @@ can be used to explore this matter in more detail.
{{ProcessingInstruction}}, or {{Comment}}.

<p>Objects that implement {{Text}} sometimes implement {{CDATASection}}.

<p>Thus, every [=node=]'s [=primary interface=] is one of: {{Attr}}, {{CDATASection}}, {{Comment}},
{{Document}}, {{DocumentFragment}}, {{DocumentType}}, {{Element}} or an inherited interface of it,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{{Document}}, {{DocumentFragment}}, {{DocumentType}}, {{Element}} or an inherited interface of it,
{{Document}}, {{DocumentFragment}}, {{DocumentType}}, or {{Element}}; or an inherited interface of it:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I'm not sure how this is correct. Why is ProcessingInstruction an inherited interface and Comment is not?

Also, why would ShadowRoot not be a primary interface? Isn't that the most derived? And I think both Text and CDATASection are primary interfaces as they are the most derived on the objects they occur on. Just when CDATASection is the primary interface, it's also an inherited interface of Text.

Copy link
Member Author

@domenic domenic Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested change seems incorrect, and then your further comment seems to be based on confusion about what the spec text would say after that incorrect change.

I'll rephrase the original in another way. Every node's primary interface is one of:

  • Attr
  • CDATASection
  • Comment
  • Document
  • DocumentFragment
  • DocumentType
  • Element
  • HTMLElement
  • HTMLHtmlElement
  • ...
  • ProcessingInstruction
  • ShadowRoot
  • Text

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense. Can we put them in the same order as the document outline does? I think I generally try to be consistent about that node order throughout the document.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@annevk annevk merged commit abaa3fb into main Apr 22, 2024
2 checks passed
@annevk annevk deleted the terminal-node-types branch April 22, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants