Skip to content

feat: considerations for elements within ShadowRoot #12

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

Merged
merged 3 commits into from
Apr 3, 2025

Conversation

tbiethman
Copy link

@tbiethman tbiethman commented Mar 31, 2025

Ran into a few cases here where the APIs in use do not account for the elements being contained in a Shadow DOM.

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2025

CLA assistant check
All committers have signed the CLA.

@tbiethman tbiethman marked this pull request as ready for review April 3, 2025 16:24
@tbiethman tbiethman changed the title feat: considerations for elements within ShadowRoot fix: considerations for elements within ShadowRoot Apr 3, 2025
Copy link

@mike-plummer mike-plummer left a comment

Choose a reason for hiding this comment

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

LGTM, but should probably have some doc updates (README and maybe a mention in the unique function's JSDoc) about how selectors are unique within given contexts and not guaranteed unique within the entire document

Comment on lines +11 to +15
// Using getRootNode here to scope checks to any parent
// ShadowRoot. getRootNode will otherwise return the
// document associated to the elements page/frame (like
// the ownerDocument property would).
var elems = el.getRootNode().querySelectorAll(selector);

Choose a reason for hiding this comment

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

TIL 🧠

@tbiethman tbiethman changed the title fix: considerations for elements within ShadowRoot feat: considerations for elements within ShadowRoot Apr 3, 2025
@tbiethman tbiethman merged commit 2d5844c into master Apr 3, 2025
3 checks passed
Copy link

github-actions bot commented Apr 3, 2025

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants