mirror of https://github.com/gorhill/uBlock.git
not needed, this will address one FF validator warning
This commit is contained in:
parent
91cb61ce9c
commit
8afe6aa275
|
@ -58,9 +58,6 @@ var DOMListFactory = function(selector, context) {
|
||||||
var r = new DOMList();
|
var r = new DOMList();
|
||||||
if ( typeof selector === 'string' ) {
|
if ( typeof selector === 'string' ) {
|
||||||
selector = selector.trim();
|
selector = selector.trim();
|
||||||
if ( selector.charAt(0) === '<' ) {
|
|
||||||
return addHTMLToList(r, selector);
|
|
||||||
}
|
|
||||||
if ( selector !== '' ) {
|
if ( selector !== '' ) {
|
||||||
return addSelectorToList(r, selector, context);
|
return addSelectorToList(r, selector, context);
|
||||||
}
|
}
|
||||||
|
@ -125,51 +122,6 @@ var addSelectorToList = function(list, selector, context) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var pTagOfChildTag = {
|
|
||||||
'tr': 'table',
|
|
||||||
'option': 'select'
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: documentFragment
|
|
||||||
|
|
||||||
var addHTMLToList = function(list, html) {
|
|
||||||
var matches = html.match(/^<([a-z]+)/);
|
|
||||||
if ( !matches || matches.length !== 2 ) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
var cTag = matches[1];
|
|
||||||
var pTag = pTagOfChildTag[cTag] || 'div';
|
|
||||||
var p = document.createElement(pTag);
|
|
||||||
vAPI.insertHTML(p, html);
|
|
||||||
// Find real parent
|
|
||||||
var c = p.querySelector(cTag);
|
|
||||||
p = c.parentNode;
|
|
||||||
while ( p.firstChild ) {
|
|
||||||
list.nodes.push(p.removeChild(p.firstChild));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
};
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
var isChildOf = function(child, parent) {
|
|
||||||
return child !== null && parent !== null && child.parentNode === parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
var isDescendantOf = function(descendant, ancestor) {
|
|
||||||
while ( descendant.parentNode !== null ) {
|
|
||||||
if ( descendant.parentNode === ancestor ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
descendant = descendant.parentNode;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
var nodeInNodeList = function(node, nodeList) {
|
var nodeInNodeList = function(node, nodeList) {
|
||||||
var i = nodeList.length;
|
var i = nodeList.length;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
|
|
Loading…
Reference in New Issue