Helpful-Extensions icon indicating copy to clipboard operation
Helpful-Extensions copied to clipboard

Fix issues in target-blank.js (OSOE-576)

Open 0liver opened this issue 2 years ago • 3 comments

Follow-up to https://github.com/Lombiq/Helpful-Extensions/issues/104.

See comments here and below.

  1. Use DOMContentLoaded event instead of load. There's no third parameter there.
  2. Remove the setTimeout indirection from the event handler. Simply pass targetBlank as the handler.
  3. Remove superfluous configuration from package.json file: a. "nodejsExtensions" b. "devDependencies"
  4. Use compiled scripts from wwwroot\js folder instead of wwwroot\scripts here after 3.a.
  5. Reorder the conditions here.

Jira issue

0liver avatar Feb 20 '23 09:02 0liver

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?

TheHydes avatar Feb 20 '23 09:02 TheHydes

No.

    window.addEventListener(
        'load',
        () => {
            window.setTimeout(targetBlank, 100);
        },
        false);

Should become:

    document.addEventListener('DOMContentLoaded', targetBlank);

0liver avatar Feb 20 '23 10:02 0liver

I see, understood.

TheHydes avatar Feb 20 '23 10:02 TheHydes

Fixed in https://github.com/Lombiq/Helpful-Extensions/pull/117.

Piedone avatar May 12 '24 20:05 Piedone