Skip to content

Commit d41989e

Browse files
committed
Improve disable-newtab-links scriptlet
Related discussion: uBlockOrigin/uBlock-issues#3551
1 parent 7fb656b commit d41989e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/js/resources/scriptlets.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,8 +2222,8 @@ builtinScriptlets.push({
22222222
});
22232223
// https://github.com/uBlockOrigin/uAssets/issues/913
22242224
function disableNewtabLinks() {
2225-
document.addEventListener('click', function(ev) {
2226-
var target = ev.target;
2225+
document.addEventListener('click', ev => {
2226+
let target = ev.target;
22272227
while ( target !== null ) {
22282228
if ( target.localName === 'a' && target.hasAttribute('target') ) {
22292229
ev.stopPropagation();
@@ -2232,7 +2232,7 @@ function disableNewtabLinks() {
22322232
}
22332233
target = target.parentNode;
22342234
}
2235-
});
2235+
}, { capture: true });
22362236
}
22372237

22382238
/******************************************************************************/

0 commit comments

Comments
 (0)