From b6374725e6ecb8c898890f4c5f2292c8bdc2e418 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 5 Nov 2014 10:29:19 -0500 Subject: [PATCH] this addresses one part of #356 --- js/contentscript-end.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/js/contentscript-end.js b/js/contentscript-end.js index 0ca2084fc..1d5b3e112 100644 --- a/js/contentscript-end.js +++ b/js/contentscript-end.js @@ -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;