this addresses one part of #356

This commit is contained in:
gorhill 2014-11-05 10:29:19 -05:00
parent a2eed5220f
commit b6374725e6
1 changed files with 5 additions and 20 deletions

View File

@ -479,27 +479,12 @@ var uBlockMessaging = (function(name){
var i = nodes.length;
while ( i-- ) {
node = nodes[i];
if ( node.nodeType !== 1 ) { continue; }
// class
v = nodes[i].className;
// it could be an SVGAnimatedString...
if ( typeof v !== 'string' ) { continue; }
v = v.trim();
if ( v === '' ) { continue; }
// one class
if ( v.indexOf(' ') < 0 ) {
v = '.' + v;
if ( qq[v] ) { continue; }
cc[v] = true;
qq[v] = true;
continue;
}
// many classes
vv = v.trim().split(' ');
j = vv.length;
vv = node.classList;
if ( typeof vv !== 'object' ) { continue; }
j = vv.length || 0;
while ( j-- ) {
v = vv[j].trim();
if ( v === '' ) { continue; }
v = vv[j];
if ( typeof v !== 'string' ) { continue; }
v = '.' + v;
if ( qq[v] ) { continue; }
cc[v] = true;