-
Notifications
You must be signed in to change notification settings - Fork 37
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
Move adoptedStyleSheets from Element to Node, also add getRootNode()? #85
Comments
It's tricky, we had some discussion about this here: #76 (comment) The issue is these "interfaces" that appear in the spec (like I'd prefer not to touch |
The real problem I'm facing though, is the need to downcast a
If
Given that It's not that I think |
What's the situation where you need to access adoptedStyleSheets from a Node? Do you a code sample? |
Sure. Here I'm using |
Ah, ok, I see your point. Tricky part is according to the documentation it doesn't really return Node but either HTMLDocument or ShadowRoot (a "union" again). Hmm... |
That documentation says that it returns a Node:
It then goes on to list the concrete types. |
Hmm, still unsure if |
I think there's an argument for moving adoptedStyleSheets from Element to Node. According to the spec and examples, you only expect to see this on a root node such as HTMLDocument and ShadowRoot.
Neither of these appears to be an Element, but both inherit from Node:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLDocument
and
https://dom.spec.whatwg.org/#documentfragment
In addition, it would be useful to add
getRootNode()
with the same extension (or elsewhere).https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode
If in agreement, I can submit a PR that changes this code to
The text was updated successfully, but these errors were encountered: