Properly detect attachment of Shadow DOM elements #3504

Open
gibson042 opened this Issue Jan 16, 2017 · 2 comments

Comments

Projects
None yet
2 participants
Member

gibson042 commented Jan 16, 2017

There are a few places where we check document attachment with jQuery.contains( elem.ownerDocument, elem ) (isHiddenWithinTree for show/hide, curCSS for inline style fallback, buildFragment/domManip/remove/jQuery.clone for managing script evaluation during DOM manipulation), all of which fail inside Shadow DOM:

$.contains(document, elem) will return false when elem is shown in a shadow dom.
change to elem.getRootNode({composed: true}) === elem.ownerDocument works.

We should investigate the cost of a remedy (e.g., a Shadow-DOM-compatible isAttached( elem ) function).

Owner

timmywil commented Feb 6, 2017

Yes to going forward and investigating, but we may scrap it later depending on how involved this gets.

timmywil removed the Needs review label Feb 6, 2017

Member

gibson042 commented Feb 6, 2017

As noted in the meeting, we'd probably benefit from an internal isAttached even if it doesn't handle shadow DOM, because it better communicates intent.

timmywil added this to the 3.2.0 milestone Feb 13, 2017

@timmywil timmywil modified the milestone: 3.3.0, 3.2.0 Mar 6, 2017

gibson042 was assigned by timmywil Mar 27, 2017

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