Helpful-Extensions
Helpful-Extensions copied to clipboard
Fix issues in target-blank.js (OSOE-576)
Follow-up to https://github.com/Lombiq/Helpful-Extensions/issues/104.
See comments here and below.
- Use
DOMContentLoaded
event instead ofload
. There's no third parameter there. - Remove the
setTimeout
indirection from the event handler. Simply passtargetBlank
as the handler. - Remove superfluous configuration from package.json file:
a.
"nodejsExtensions"
b."devDependencies"
- Use compiled scripts from wwwroot\js folder instead of wwwroot\scripts here after 3.a.
- Reorder the conditions here.
From target-blank.js the whole second part can be removed starting with "window.addEventListener...", that makes the "Use DOMContentLoaded event instead of..." part unneccesary, right?
No.
window.addEventListener(
'load',
() => {
window.setTimeout(targetBlank, 100);
},
false);
Should become:
document.addEventListener('DOMContentLoaded', targetBlank);
I see, understood.
Fixed in https://github.com/Lombiq/Helpful-Extensions/pull/117.