mirror of https://github.com/gorhill/uBlock.git
Improve `prevent-addEventListener` scriptlet
Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3061#issuecomment-2159662039
This commit is contained in:
parent
79c2eec802
commit
91ee5bdeae
|
@ -1642,6 +1642,8 @@ function addEventListenerDefuser(
|
||||||
const debug = shouldDebug(extraArgs);
|
const debug = shouldDebug(extraArgs);
|
||||||
const targetSelector = extraArgs.elements || undefined;
|
const targetSelector = extraArgs.elements || undefined;
|
||||||
const elementMatches = elem => {
|
const elementMatches = elem => {
|
||||||
|
if ( targetSelector === 'window' ) { return elem === window; }
|
||||||
|
if ( targetSelector === 'document' ) { return elem === document; }
|
||||||
if ( elem && elem.matches && elem.matches(targetSelector) ) { return true; }
|
if ( elem && elem.matches && elem.matches(targetSelector) ) { return true; }
|
||||||
const elems = Array.from(document.querySelectorAll(targetSelector));
|
const elems = Array.from(document.querySelectorAll(targetSelector));
|
||||||
return elems.includes(elem);
|
return elems.includes(elem);
|
||||||
|
|
|
@ -156,7 +156,7 @@
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
},
|
},
|
||||||
"showBlockedCountLabel": {
|
"showBlockedCountLabel": {
|
||||||
"message": "在工具栏图标上显示已拦截的请求数",
|
"message": "在工具栏图标上显示拦截请求数",
|
||||||
"description": "Label for a checkbox in the options page"
|
"description": "Label for a checkbox in the options page"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "extension name."
|
"description": "extension name."
|
||||||
},
|
},
|
||||||
"extShortDesc": {
|
"extShortDesc": {
|
||||||
"message": "Нарэшце, эфектыўны блакіроўшчык. Не нагружае працэсар і памяць.",
|
"message": "Нарэшце, эфектыўны блакавальнік. Не нагружае працэсар і памяць.",
|
||||||
"description": "this will be in the Chrome web store: must be 132 characters or less"
|
"description": "this will be in the Chrome web store: must be 132 characters or less"
|
||||||
},
|
},
|
||||||
"dashboardName": {
|
"dashboardName": {
|
||||||
|
|
|
@ -540,7 +540,7 @@
|
||||||
"description": "Warning against copy-pasting filters from random sources"
|
"description": "Warning against copy-pasting filters from random sources"
|
||||||
},
|
},
|
||||||
"1pEnableMyFiltersLabel": {
|
"1pEnableMyFiltersLabel": {
|
||||||
"message": "Enable my custom filters",
|
"message": "Aktibatu nire filtro pertsonalitsatuak",
|
||||||
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
"description": "Label for the checkbox use to enable/disable 'My filters' list"
|
||||||
},
|
},
|
||||||
"1pTrustMyFiltersLabel": {
|
"1pTrustMyFiltersLabel": {
|
||||||
|
|
Loading…
Reference in New Issue