mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Improve disable-newtab-links scriptlet
Related discussion: https://github.com/uBlockOrigin/uBlock-issues/discussions/3551
This commit is contained in:
parent
7fb656b653
commit
d41989e62a
1 changed files with 3 additions and 3 deletions
|
|
@ -2222,8 +2222,8 @@ builtinScriptlets.push({
|
|||
});
|
||||
// https://github.com/uBlockOrigin/uAssets/issues/913
|
||||
function disableNewtabLinks() {
|
||||
document.addEventListener('click', function(ev) {
|
||||
var target = ev.target;
|
||||
document.addEventListener('click', ev => {
|
||||
let target = ev.target;
|
||||
while ( target !== null ) {
|
||||
if ( target.localName === 'a' && target.hasAttribute('target') ) {
|
||||
ev.stopPropagation();
|
||||
|
|
@ -2232,7 +2232,7 @@ function disableNewtabLinks() {
|
|||
}
|
||||
target = target.parentNode;
|
||||
}
|
||||
});
|
||||
}, { capture: true });
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
|
|||
Loading…
Reference in a new issue