script type="module" evaluation sets document.currentScript

Fixed, flighted Issue #9697735

Details

Author
Dominic C.
Created
Nov 7, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
14.14393
Fixed in build #
15002
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Turn on Experimental JavaScript features to enable ECMAScript modules and load the following HTML:

<!DOCTYPE html>
<script type="module">
export default 42;
console.log(document.currentScript);
</script>

Expected result: logs null.
Actual result: logs the script element.

Background:

This script is handled as a module–it does not produce a syntax error (compare with the result if type="module" is omitted.)

See the algorithm to “execute a script block” https://html.spec.whatwg.org/#execute-the-script-block step 5."module" case.1:

“Set the script element’s node document’s currentScript attribute to null.”

document.currentScript should be null, not the script block.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Jeff W.”

      Changed Status to “Confirmed”

      Changed Status from “Confirmed” to “In progress”

      Changed Status from “In progress” to “In code review”

      Changed Status from “In code review” to “In progress”

      Changed Status from “In progress” to “Fixed, not yet flighted”

      Changed Status from “Fixed, not yet flighted” to “Fixed, flighted”

    • Hello,

      Thank you for providing this information about the issue. We are pleased to report this feature is fixed in Edge 15063 and is available in our latest Insider Preview build.

      Best Wishes,
      The MS Edge Team

    You need to sign in to your Microsoft account to add a comment.

    Sign in