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

attr-associated elements use inconsistent trees? #9071

Open
emilio opened this issue Mar 24, 2023 · 5 comments
Open

attr-associated elements use inconsistent trees? #9071

emilio opened this issue Mar 24, 2023 · 5 comments
Labels
clarification Standard could be clearer topic: reflect For issues with reflected IDL attributes and friends topic: shadow Relates to shadow trees (as defined in DOM)

Comments

@emilio
Copy link
Contributor

emilio commented Mar 24, 2023

https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#attr-associated-element says:

If reflectedTarget's explicitly set attr-element is a descendant of any of element's shadow-including ancestors, then return reflectedTarget's explicitly set attr-element.

I wonder if the use of DOM descendant but then shadow-including ancestors is intentional? Seems a bit weird that it's not symmetric but maybe it's fine?

@emilio
Copy link
Contributor Author

emilio commented Mar 24, 2023

cc @mfreed7

@annevk
Copy link
Member

annevk commented Mar 24, 2023

That's intentional. As otherwise you break encapsulation.

@annevk annevk added topic: shadow Relates to shadow trees (as defined in DOM) topic: reflect For issues with reflected IDL attributes and friends labels Mar 24, 2023
@emilio
Copy link
Contributor Author

emilio commented Mar 24, 2023

Might be worth a note in the spec then :)

@emilio emilio closed this as completed Mar 24, 2023
@emilio
Copy link
Contributor Author

emilio commented Mar 24, 2023

(Though if you had already associated the element explicitly it seems it would've been fine to just check that both elements are shadow-including-connected? I don't have a strong opinion, it was just a bit weird when reading it)

@annevk
Copy link
Member

annevk commented Mar 24, 2023

If you want a note we should keep this open.

The reason is that the getter in question is public API and can thus be observed by scripts otherwise encapsulated from the shadow tree.

I created #8932 to give more power to getters where that is not the case (those on ElementInternals).

@annevk annevk reopened this Mar 24, 2023
@annevk annevk added the clarification Standard could be clearer label Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: reflect For issues with reflected IDL attributes and friends topic: shadow Relates to shadow trees (as defined in DOM)
Development

No branches or pull requests

2 participants