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

Adoption and DocumentFragment #16348

Merged
merged 3 commits into from
Dec 11, 2019
Merged

Adoption and DocumentFragment #16348

merged 3 commits into from
Dec 11, 2019

Conversation

annevk
Copy link
Member

@annevk annevk commented Apr 15, 2019

Tests for whatwg/dom#744.

The assumption here is an early return for DocumentFragment that has a host by adoptNode() and that adoption generally doesn't affect DocumentFragment otherwise (only its children).

@wpt-pr-bot wpt-pr-bot added the dom label Apr 15, 2019
@wpt-pr-bot wpt-pr-bot requested review from jdm and zqzhang April 15, 2019 14:23
annevk added a commit to whatwg/dom that referenced this pull request Apr 15, 2019
And do not allow non-null host DocumentFragment nodes to be adopted.

This means that a DocumentFragment is no longer implicitly adopted and a DocumentFragment with a non-null host cannot be put in a "weird" state.

Tests: web-platform-tests/wpt#16348.

Fixes #744.
@annevk

This comment has been minimized.


calls = [];
doc.documentElement.appendChild(shadowRoot);
if (documentName === "the document of the template elements") {
Copy link
Member Author

Choose a reason for hiding this comment

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

@rniwa this seems a little ugly btw, but I wasn't sure how to avoid it.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about doc === host.content.ownerDocument ?

annevk added a commit to whatwg/dom that referenced this pull request Dec 6, 2019
And do not allow non-null host DocumentFragment nodes to be adopted.

This means that a DocumentFragment is no longer implicitly adopted and a DocumentFragment with a non-null host cannot be put in a "weird" state.

Tests: web-platform-tests/wpt#16348.

Fixes #744.
Tests for whatwg/dom#744.

The assumption here is an early return for DocumentFragment that has a host by adoptNode() and that adoption generally doesn't affect DocumentFragment otherwise (only its children).
@annevk
Copy link
Member Author

annevk commented Dec 7, 2019

@foolip care to review this?

@annevk
Copy link
Member Author

annevk commented Dec 10, 2019

@tkent-google could you maybe review this given that you reviewed the corresponding spec PR?

return getDocument().then(function (doc) {
var instance = document.createElement('my-custom-element');
var host = document.createElement('template');
var shadowRoot = host.content;
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable name shadowRoot is very confusing. It should be documentFragment or something.


calls = [];
doc.documentElement.appendChild(shadowRoot);
if (documentName === "the document of the template elements") {
Copy link
Contributor

Choose a reason for hiding this comment

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

How about doc === host.content.ownerDocument ?

annevk added a commit to whatwg/dom that referenced this pull request Dec 11, 2019
Also do not allow DocumentFragment nodes with host to be adopted. This means that a DocumentFragment is no longer implicitly adopted and a DocumentFragment with a (non-null) host cannot be put in a "weird" state.

Tests: web-platform-tests/wpt#16348.

Fixes #744.
@foolip
Copy link
Member

foolip commented Dec 11, 2019

Sorry, still getting used to new email filtering setup. I'll not review given that @tkent-google started doing so.

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

Successfully merging this pull request may close these issues.

6 participants