mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
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();
|
||||
if ( typeof selector === 'string' ) {
|
||||
selector = selector.trim();
|
||||
if ( selector.charAt(0) === '<' ) {
|
||||
return addHTMLToList(r, selector);
|
||||
}
|
||||
if ( selector !== '' ) {
|
||||
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 i = nodeList.length;
|
||||
while ( i-- ) {
|
||||
|
Loading…
Reference in New Issue
Block a user