1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-16 23:42:39 +01:00

Fixes 1357

This commit is contained in:
Chris 2015-05-05 20:20:36 -06:00
parent 0d529677c4
commit a9e77b4d48
2 changed files with 9 additions and 1 deletions

View File

@ -193,6 +193,15 @@ var uBlockCollapser = (function() {
hostname: window.location.hostname, hostname: window.location.hostname,
selectors: selectors 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 // Renew map: I believe that even if all properties are deleted, an
// object will still use more memory than a brand new one. // object will still use more memory than a brand new one.

View File

@ -94,7 +94,6 @@ var cosmeticFilters = function(details) {
var text = hide.join(',\n'); var text = hide.join(',\n');
hideElements(text); hideElements(text);
var style = vAPI.specificHideStyle = document.createElement('style'); 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;}')); 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); //console.debug('µBlock> "%s" cosmetic filters: injecting %d CSS rules:', details.domain, details.hide.length, hideStyleText);
var parent = document.head || document.documentElement; var parent = document.head || document.documentElement;