From 80219983af3e9aa0f1e0f31f5c707b46e47e584a Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 25 Jun 2014 10:02:05 -0400 Subject: [PATCH] this fixes #13 --- js/contentscript-end.js | 22 ++++++++++++---------- manifest.json | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/js/contentscript-end.js b/js/contentscript-end.js index 3e15e04a7..65bd0d6df 100644 --- a/js/contentscript-end.js +++ b/js/contentscript-end.js @@ -293,11 +293,7 @@ CosmeticFiltering.prototype.idsFromNodeList = function(nodes) { var i = nodes.length; while ( i-- ) { id = nodes[i].id; - if ( typeof id !== 'string' ) { - continue; - } - id = id.trim(); - if ( id === '' ) { + if ( !id ) { continue; } id = '#' + id; @@ -312,6 +308,15 @@ CosmeticFiltering.prototype.idsFromNodeList = function(nodes) { CosmeticFiltering.prototype.allFromNodeList = function(nodes) { this.classesFromNodeList(nodes); this.idsFromNodeList(nodes); + var i = nodes.length; + var node; + while ( i-- ) { + node = nodes[i]; + if ( node.querySelectorAll ) { + this.classesFromNodeList(node.querySelectorAll('*[class]')); + this.idsFromNodeList(node.querySelectorAll('*[id]')); + } + } }; var cosmeticFiltering = new CosmeticFiltering(); @@ -323,12 +328,9 @@ var mutationObservedHandler = function(mutations) { var mutation; while ( iMutation-- ) { mutation = mutations[iMutation]; - if ( !mutation.addedNodes || !mutation.addedNodes.length ) { - // TODO: attr changes also must be dealth with, but then, how - // likely is it... - continue; + if ( mutation.addedNodes ) { + cosmeticFiltering.allFromNodeList(mutation.addedNodes); } - cosmeticFiltering.allFromNodeList(mutation.addedNodes); } cosmeticFiltering.retrieveGenericSelectors(); diff --git a/manifest.json b/manifest.json index b9ff0dcf8..03711a901 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_extName__", "short_name": "µBlock", - "version": "0.1.0.6", + "version": "0.1.0.7", "description": "__MSG_extShortDesc__", "icons": { "16": "img/icon_16.png",