Skip to content

Commit

Permalink
include link to issue on webcomponents
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Aug 16, 2016
1 parent 5834723 commit cd883fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions inert.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ class InertRoot {
if (shadowRoot) {
rootObserver.observe(shadowRoot, { childList: true, subtree: true });
} else {
// Might create a shadowRoot in the future, either by attachShadow
// (ShadowDOM v1) or by createShadowRoot (ShadowDOM v0), so we patch both
// of them.
// ShadowDOM v1 support.
// NOTE(valdrin) There is no way to observe shadow root attachment (yet),
// patching might be slow https://github.com/w3c/webcomponents/issues/204
const attachShadowFn = this._rootElement.attachShadow;
if (attachShadowFn) {
this._rootElement.attachShadow = function patchedAttachShadow() {
Expand All @@ -97,6 +97,9 @@ class InertRoot {
return shadowRoot;
};
}
// ShadowDOM v0 support.
// NOTE(valdrin) There is no way to observe shadow root attachment (yet),
// patching might be slow https://github.com/w3c/webcomponents/issues/204
const createShadowRootFn = this._rootElement.createShadowRoot;
if (createShadowRootFn) {
this._rootElement.createShadowRoot = function patchedCreateShadowRoot() {
Expand Down

0 comments on commit cd883fb

Please sign in to comment.