Skip to content

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
@github-actions
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.

5 participants