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 30, 2016
1 parent 6d77168 commit f7c12fd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 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 All @@ -118,7 +121,7 @@ class InertRoot {
this._observer = null;

this._rootObserver.disconnect();
delete this._rootObserver;
this._rootObserver = null;

if (this._rootElement)
this._rootElement.removeAttribute('aria-hidden');
Expand Down

0 comments on commit f7c12fd

Please sign in to comment.