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

Properly detect attachment of Shadow DOM elements #3504

Closed
gibson042 opened this issue Jan 16, 2017 · 2 comments
Closed

Properly detect attachment of Shadow DOM elements #3504

gibson042 opened this issue Jan 16, 2017 · 2 comments
Assignees
Milestone

Comments

@gibson042
Copy link
Member

@gibson042 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).

@timmywil
Copy link
Member

@timmywil timmywil commented Feb 6, 2017

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

@gibson042
Copy link
Member Author

@gibson042 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 timmywil added this to the 3.2.0 milestone Feb 13, 2017
@timmywil timmywil modified the milestones: 3.3.0, 3.2.0 Mar 6, 2017
@timmywil timmywil modified the milestones: 3.3.0, 3.4.0 Nov 13, 2017
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 14, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 14, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 14, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 15, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 16, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 16, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Feb 28, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Mar 2, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Mar 2, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Ref jquerygh-3504
mgol added a commit that referenced this issue Mar 5, 2018
This change replaces the use of contains to check for attachment
by isAttached function

Closes gh-3977
Ref gh-3504
SaptakS added a commit to SaptakS/jquery that referenced this issue Mar 5, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
SaptakS added a commit to SaptakS/jquery that referenced this issue Mar 26, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
SaptakS added a commit to SaptakS/jquery that referenced this issue Apr 12, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
SaptakS added a commit to SaptakS/jquery that referenced this issue Apr 13, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
SaptakS added a commit to SaptakS/jquery that referenced this issue Apr 13, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
SaptakS added a commit to SaptakS/jquery that referenced this issue Sep 24, 2018
Allow isAttached to check shadow DOM for attachment. This change allows
isAttached() function to address shadowDOM elements even if the browser doesn't support getRootNode()

Ref jquerygh-3504, jquerygh-3977
@mgol mgol closed this in 9b77def Nov 9, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants