diff options
author | gorhill <rhill@raymondhill.net> | 2014-09-05 16:13:48 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2014-09-05 16:13:48 -0400 |
commit | 1f2ad19a2259a07806a53c14c7dbd1e0ad9310ee (patch) | |
tree | e9bda883a9645053bfef92e346c3149cd57e794b /js | |
parent | 852e17058649631c1dfddf8060f118d8b1466ead (diff) | |
download | uBlock-1f2ad19a2259a07806a53c14c7dbd1e0ad9310ee.zip uBlock-1f2ad19a2259a07806a53c14c7dbd1e0ad9310ee.tar.gz uBlock-1f2ad19a2259a07806a53c14c7dbd1e0ad9310ee.tar.bz2 |
code review
Diffstat (limited to 'js')
-rw-r--r-- | js/contentscript-end.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/js/contentscript-end.js b/js/contentscript-end.js index 099e0a7..9c2cdb1 100644 --- a/js/contentscript-end.js +++ b/js/contentscript-end.js @@ -501,7 +501,7 @@ var uBlockMessaging = (function(name){ if ( typeof node.querySelectorAll !== 'function' ) { continue; } - if ( ignoreTags[node.tagName] ) { + if ( ignoreTags.hasOwnProperty(node.tagName) ) { continue; } contextNodes.push(node); @@ -563,13 +563,14 @@ var uBlockMessaging = (function(name){ } // If `!important` is not there, going back using history will // likely cause the hidden element to re-appear. - elem.style.visibility = 'hidden !important'; if ( collapse ) { if ( elem.parentNode ) { elem.parentNode.removeChild(elem); } else { - elem.style.display = 'none !important'; + elem.style.setProperty('display', 'none', 'important'); } + } else { + elem.style.setProperty('visibility', 'hidden', 'important'); } selectors.push(tagName + '[' + prop + '="' + src + '"]'); } @@ -594,6 +595,7 @@ var uBlockMessaging = (function(name){ var failedElements = { 'img': 'src', + 'input': 'src', 'object': 'data' }; @@ -619,15 +621,15 @@ var uBlockMessaging = (function(name){ } // If `!important` is not there, going back using history will // likely cause the hidden element to re-appear. - target.style.visibility = 'hidden !important'; if ( details.collapse ) { if ( target.parentNode ) { target.parentNode.removeChild(target); } else { - target.style.display = 'none !important'; + target.style.setProperty('display', 'none', 'important'); } + } else { + target.style.setProperty('visibility', 'hidden', 'important'); } - // TODO: investigate injecting as a style. Is overhead worth it? messaging.tell({ what: 'injectedSelectors', type: 'net', @@ -644,7 +646,7 @@ var uBlockMessaging = (function(name){ }; var onResourceFailed = function(ev) { - //console.debug('Failed to load %o[src="%s"]', eev.target.tagName, ev.target.src); + //console.debug('Failed to load %s[src="%s"]', ev.target.tagName, ev.target.src); onResource(ev.target, failedElements); }; |