this fixes #13

This commit is contained in:
gorhill 2014-06-25 10:02:05 -04:00
parent 6a54e098d5
commit 80219983af
2 changed files with 13 additions and 11 deletions

View File

@ -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,13 +328,10 @@ 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.retrieveGenericSelectors();
};

View File

@ -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",