Skip to content

import.meta.url does not include fragments #5162

@Constellation

Description

@Constellation

While upgrading WebKit module loader, @youennf noticed that we are using response's url when creating module-script[1].

Let module script be the result of creating a module script given source text, module map settings object, response's url, and options.

However, response's url does not include fragments[2,3]. This means, import.meta.url does not include fragments, and this behavior does not agree with what WPT is testing[4].

Shouldn't we include fragments in import.meta.url? Or should we do that by fixing the current HTML spec? I'm thinking that we should expose fragments because each module w/ URL+different fragments is distinct. But this means we cannot use response's url for import.meta.url in the HTML spec though.

/cc @domenic

1: https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-single-module-script
2: https://fetch.spec.whatwg.org/#ref-for-response-url
3: https://fetch.spec.whatwg.org/#response-url
4: https://github.com/web-platform-tests/wpt/blob/master/html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html#L54-L57

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions