Skip to content

Conversation

@alexalekseyenko
Copy link
Contributor

Previously, el.contains(e) would return false if e was inside ShadowRoots. If el.contains(e) returns false, isContainedWithin(e, el) will instead check e's root, and the root's root, and so on, until either contains returns true or the top of the tree is reached.

Previously, `el.contains(e)` would return `false` if `e` was inside ShadowRoots. If `el.contains(e)` returns `false`, `isContainedWithin(e, el)` will instead check `e`'s root, and the root's root, and so on, until either `contains` returns `true` or the top of the tree is reached.
@alexalekseyenko
Copy link
Contributor Author

Regarding the other two instances of contains in utils.js:

if (elementWithHref && elementWithHref !== e && elementWithHref.contains(e)) {

if (!elements[i].contains(last(result))

presumably we could run into the same issue with ShadowRoots, but I don't know if I've encountered it in the wild yet, so I thought it might be best to keep the change smaller for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant