mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
#815: code review
This commit is contained in:
parent
0dc5c62b1e
commit
0cdf937a5e
1 changed files with 7 additions and 7 deletions
|
@ -159,13 +159,13 @@ try {
|
|||
/******************************************************************************/
|
||||
|
||||
var safeQuerySelectorAll = function(node, selector) {
|
||||
var nodeList;
|
||||
try {
|
||||
nodeList = node.querySelectorAll(selector);
|
||||
} catch (e) {
|
||||
nodeList = [];
|
||||
if ( node !== null ) {
|
||||
try {
|
||||
return node.querySelectorAll(selector);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
return nodeList;
|
||||
return [];
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -366,7 +366,7 @@ var cosmeticFilterFromElement = function(elem, out) {
|
|||
// `nth-of-type`. It is preferable to use `nth-of-type` as opposed to
|
||||
// `nth-child`, as `nth-of-type` is less volatile.
|
||||
var parentNode = elem.parentNode;
|
||||
if ( parentNode !== null && safeQuerySelectorAll(parentNode, cssScope + selector).length > 1 ) {
|
||||
if ( safeQuerySelectorAll(parentNode, cssScope + selector).length > 1 ) {
|
||||
i = 1;
|
||||
while ( elem.previousSibling !== null ) {
|
||||
elem = elem.previousSibling;
|
||||
|
|
Loading…
Reference in a new issue