1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00
This commit is contained in:
gorhill 2015-02-16 11:14:37 -05:00
parent 4dccf04b24
commit 0dc5c62b1e

View File

@ -158,6 +158,18 @@ try {
/******************************************************************************/
var safeQuerySelectorAll = function(node, selector) {
var nodeList;
try {
nodeList = node.querySelectorAll(selector);
} catch (e) {
nodeList = [];
}
return nodeList;
};
/******************************************************************************/
var pausePicker = function() {
dialog.parentNode.classList.add('paused');
svgListening(false);
@ -354,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 && parentNode.querySelectorAll(cssScope + selector).length > 1 ) {
if ( parentNode !== null && safeQuerySelectorAll(parentNode, cssScope + selector).length > 1 ) {
i = 1;
while ( elem.previousSibling !== null ) {
elem = elem.previousSibling;