-
Notifications
You must be signed in to change notification settings - Fork 91
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
In Shadow DOM & custom root Fallback selector is used when a better selector is available #173
Comments
Hey @niranjan94, thanks for the report. This is an interesting situation. If the root node is not defined, I was using the I have changed the root finding functionality so that it will use But this led me to realisation that we can have situations when the returned selector may not be what the users are expecting. E.g. when they expect to use I have released I'm closing the issue now. Please feel free to reopen or file a new bug when you encounter more problems with Shadow DOM. I'm pretty sure there will be plenty of special cases. |
Hey @niranjan94, I finally found out the problem. Previous changes to accommodate ShadowDOM worked fine. But there was a bug with ID selector. It was still checking against document root, even if the element was inside shadow root. This should be fixed in |
@fczbkk thanks for the fix 😄 I can confirm this works as expected now |
The test page
Test cases:
1. Element outside the shadow DOM (Works)
Returns
#shadow-host
✅2. Element inside the shadow DOM with the shadow root as the custom root (Works)
Returns
p
✅3. Another shadow host in shadow DOM with the shadow root as the custom root (Fails)
Returns
:root > :nth-child(1) > :nth-child(2)
❌Expected
#nested-shadow-host
✅Awesome library btw 😄
Very useful.
The text was updated successfully, but these errors were encountered: