From a9e77b4d4824e8725b54cc54a5d2ff83a9d6d201 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 5 May 2015 20:20:36 -0600 Subject: [PATCH] Fixes 1357 --- src/js/contentscript-end.js | 9 +++++++++ src/js/contentscript-start.js | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js index db1af9cb8..3841f7915 100644 --- a/src/js/contentscript-end.js +++ b/src/js/contentscript-end.js @@ -193,6 +193,15 @@ var uBlockCollapser = (function() { hostname: window.location.hostname, selectors: selectors }); + var selectorStr = selectors.join(',\n'), + style = document.createElement('style'); + // The linefeed before the style block is very important: do no remove! + style.appendChild(document.createTextNode(selectorStr + '\n{display:none !important;}')); + var parent = document.body || document.documentElement; + if ( parent ) { + parent.appendChild(style); + vAPI.styles.push(style); + } } // Renew map: I believe that even if all properties are deleted, an // object will still use more memory than a brand new one. diff --git a/src/js/contentscript-start.js b/src/js/contentscript-start.js index 9e5210dfb..1dcfbb953 100644 --- a/src/js/contentscript-start.js +++ b/src/js/contentscript-start.js @@ -94,7 +94,6 @@ var cosmeticFilters = function(details) { var text = hide.join(',\n'); hideElements(text); var style = vAPI.specificHideStyle = document.createElement('style'); - // The linefeed before the style block is very important: do not remove! style.appendChild(document.createTextNode(text + '\n{display:none !important;}')); //console.debug('µBlock> "%s" cosmetic filters: injecting %d CSS rules:', details.domain, details.hide.length, hideStyleText); var parent = document.head || document.documentElement;