Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep fragment in the template's document during clone
The template's document doesn't have a browsing context, so custom elements aren't upgraded. This change defers upgrading any custom elements inside the template until after the treewalker that links the Parts to the DOM. This is important because custom elements can modify their DOM at upgrade time (e.g. when using ShadyDOM). Fixes #231
- Loading branch information
8697b40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change results in contained custom elements never becoming fully adopted even when this element is finally adopted. This means that contained elements will always be matched by the
:unresolved
CSS pseudo-property.In https://codepen.io/depeele/pen/QBdZyo using
lit-html:v0.10.0
the containedtest-item
is considered resolved in the final document.In https://codepen.io/depeele/pen/PBWyzB using
lit-html:v0.10.1
but otherwise the same code,test-item
is not considered resolved in the final document.8697b40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you've found a browser bug. I don't see any red border when opening the v0.10.1 version in Safari.
8697b40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out, the WebComponents standards committee decided to rename
:unresolved
to:not(:defined)
(w3c/webcomponents issue 418).See https://codepen.io/depeele/pen/gjGPRy which uses
lit-html:v0.10.1
and the new pseudo-property.8697b40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a relief!