aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-10-14 16:49:57 -0400
committergorhill <rhill@raymondhill.net>2015-10-14 16:49:57 -0400
commitea4d5a9710ff4bdabd1335fe88488b5d49d7cfd8 (patch)
treeb153a9ec2d47e8d856e64663280886b6a9375d89 /src
parent135ad95d61871db9054a52e478170d5f91221787 (diff)
downloaduBlock-ea4d5a9710ff4bdabd1335fe88488b5d49d7cfd8.zip
uBlock-ea4d5a9710ff4bdabd1335fe88488b5d49d7cfd8.tar.gz
uBlock-ea4d5a9710ff4bdabd1335fe88488b5d49d7cfd8.tar.bz2
different fix for #762, which does not create a regression of 435
Diffstat (limited to 'src')
-rw-r--r--src/js/contentscript-end.js14
-rw-r--r--src/js/contentscript-start.js14
2 files changed, 20 insertions, 8 deletions
diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js
index 7ac8505..f2986b8 100644
--- a/src/js/contentscript-end.js
+++ b/src/js/contentscript-end.js
@@ -474,21 +474,27 @@ var uBlockCollapser = (function() {
var elem, shadow;
while ( i-- ) {
elem = elems[i];
- // https://github.com/gorhill/uBlock/issues/762
- // Always hide using inline style.
- elem.style.setProperty('display', 'none', 'important');
+ shadow = elem.shadowRoot;
// https://www.chromestatus.com/features/4668884095336448
// "Multiple shadow roots is being deprecated."
- if ( elem.shadowRoot !== null ) {
+ if ( shadow !== null ) {
+ if ( shadow.className !== sessionId ) {
+ elem.style.setProperty('display', 'none', 'important');
+ }
continue;
}
// https://github.com/gorhill/uBlock/pull/555
// Not all nodes can be shadowed:
// https://github.com/w3c/webcomponents/issues/102
+ // https://github.com/gorhill/uBlock/issues/762
+ // Remove display style that might get in the way of the shadow
+ // node doing its magic.
try {
shadow = elem.createShadowRoot();
shadow.className = sessionId;
+ elem.style.removeProperty('display');
} catch (ex) {
+ elem.style.setProperty('display', 'none', 'important');
}
}
};
diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js
index b4a2b04..a625085 100644
--- a/src/js/contentscript-start.js
+++ b/src/js/contentscript-start.js
@@ -183,21 +183,27 @@ var hideElements = function(selectors) {
var elem, shadow;
while ( i-- ) {
elem = elems[i];
- // https://github.com/gorhill/uBlock/issues/762
- // Always hide using inline style.
- elem.style.setProperty('display', 'none', 'important');
+ shadow = elem.shadowRoot;
// https://www.chromestatus.com/features/4668884095336448
// "Multiple shadow roots is being deprecated."
- if ( elem.shadowRoot !== null ) {
+ if ( shadow !== null ) {
+ if ( shadow.className !== sessionId ) {
+ elem.style.setProperty('display', 'none', 'important');
+ }
continue;
}
// https://github.com/gorhill/uBlock/pull/555
// Not all nodes can be shadowed:
// https://github.com/w3c/webcomponents/issues/102
+ // https://github.com/gorhill/uBlock/issues/762
+ // Remove display style that might get in the way of the shadow
+ // node doing its magic.
try {
shadow = elem.createShadowRoot();
shadow.className = sessionId;
+ elem.style.removeProperty('display');
} catch (ex) {
+ elem.style.setProperty('display', 'none', 'important');
}
}
};