Skip to content

script event onload not working when is type module #3519

Description

@eduardocque

Basic info:

  • **Node.js version: 18
  • **jsdom version: 21.1.1

Happens in any scenario where you try to load a script dynamically as module, when is text/javascript works fine, but module no

in chrome after the script is loaded i can get perfectly the event

const script = this.jsDom.window.document.createElement('script');
script.src = url;
script.type = 'module';
script.async = true;

script.onload = async () => {
 await fancyCode();
  console.log('hi')
};

 this.jsDom.window.document.head.appendChild(script);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions