Fix highlighting nodes for net filters in element-picker

This commit is contained in:
Deathamns 2015-02-10 16:50:47 +01:00
parent 187355b2b2
commit 2d507b3edc
1 changed files with 5 additions and 2 deletions

View File

@ -271,6 +271,7 @@ var netFilterFromElement = function(elem, out) {
}; };
var netFilterSources = { var netFilterSources = {
'embed': 'src',
'iframe': 'src', 'iframe': 'src',
'img': 'src', 'img': 'src',
'object': 'data' 'object': 'data'
@ -410,15 +411,16 @@ var elementsFromFilter = function(filter) {
if ( filter.slice(0, 2) === '||' ) { if ( filter.slice(0, 2) === '||' ) {
filter = filter.replace('||', ''); filter = filter.replace('||', '');
} }
var elems = document.querySelectorAll('iframe,img,object'); var elems = document.querySelectorAll('iframe, img, object, embed');
var i = elems.length; var i = elems.length;
var elem, src; var elem, src;
while ( i-- ) { while ( i-- ) {
elem = elems[i]; elem = elems[i];
src = elem.getAttribute(netFilterSources[elem.tagName.toLowerCase()]); src = elem[netFilterSources[elem.tagName.toLowerCase()]];
if ( typeof src !== 'string' ) { if ( typeof src !== 'string' ) {
continue; continue;
} }
if ( src.indexOf(filter) !== -1 ) { if ( src.indexOf(filter) !== -1 ) {
out.push(elem); out.push(elem);
} }
@ -752,6 +754,7 @@ var startPicker = function(details) {
'a': 'href', 'a': 'href',
'img': 'src', 'img': 'src',
'iframe': 'src', 'iframe': 'src',
'embed': 'src',
'video': 'src', 'video': 'src',
'audio': 'src' 'audio': 'src'
}; };