diff options
Diffstat (limited to 'src/js/contentscript-end.js')
-rw-r--r-- | src/js/contentscript-end.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js index 776862f..f2986b8 100644 --- a/src/js/contentscript-end.js +++ b/src/js/contentscript-end.js @@ -478,7 +478,7 @@ var uBlockCollapser = (function() { // https://www.chromestatus.com/features/4668884095336448 // "Multiple shadow roots is being deprecated." if ( shadow !== null ) { - if ( shadow.className !== sessionId ) { + if ( shadow.className !== sessionId ) { elem.style.setProperty('display', 'none', 'important'); } continue; @@ -486,9 +486,13 @@ var uBlockCollapser = (function() { // 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'); } @@ -921,11 +925,15 @@ var uBlockCollapser = (function() { return; } var onMouseClick = function(ev) { + var elem = ev.target; + while ( elem !== null && elem.localName !== 'a' ) { + elem = elem.parentElement; + } messager.send({ what: 'mouseClick', x: ev.clientX, y: ev.clientY, - url: ev.target && ev.target.localName === 'a' ? ev.target.href : '' + url: elem !== null ? elem.href : '' }); }; |