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

root config doesn't allow Document #75

Open
mschile opened this issue Jan 2, 2024 · 1 comment
Open

root config doesn't allow Document #75

mschile opened this issue Jan 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mschile
Copy link

mschile commented Jan 2, 2024

For an embedded iframe, I defined root: body but this then fails if I try to find the body element since body.querySelectorAll('body') returns an empty array. This scenario seems to be handled for the default case since the ownerDocument is returned for the rootDocument instead of the body. It seems like the root config should allow both Document and Element. Then the default for root could be updated to document and I think findRootDocument could then be removed.

As a workaround, I am passing the ownerDocument and ignoring the TypeScript error.

@antonmedv antonmedv added the bug Something isn't working label Jan 3, 2024
@tilgovi
Copy link

tilgovi commented Jun 23, 2024

I think what could be done here is to use the ParentNode interface, instead. That's the common interface that defines querySelector.

Then, a short-circuit when attempting to find the node that is the root would be to return the :root pseudo-class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants