Bug 227469

Summary: JavaScript modules fail to load in XHTML documents
Product: WebKit Reporter: 00ff0000red
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: cdumez, webkit-bug-importer, youennf, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=123387
Attachments:
Description Flags
Example file that reveals the bug none

00ff0000red
Reported 2021-06-28 16:37:57 PDT
Created attachment 432441 [details] Example file that reveals the bug When attempting to load a JavaScript module file (i.e. <script type="module" src="..." />), in an XHTML document sent with the "application/xhtml+xml" MIME type, the file is not loaded at all. It appears that the XHTML document does not recognize "module" as a supported type? "nomodule" scripts also fail to load, so web applications are unable to provide a reliable fallback due to this bug.
Attachments
Example file that reveals the bug (275 bytes, application/xhtml+xml)
2021-06-28 16:37 PDT, 00ff0000red
no flags
Alexey Proskuryakov
Comment 1 2021-06-28 19:04:47 PDT
Yusuke Suzuki
Comment 2 2021-06-28 21:28:56 PDT
Currently WebKit does not support modules in XHTML files. You can use modules in HTML (non-XHTML) pages :)
Radar WebKit Bug Importer
Comment 3 2021-07-05 16:38:17 PDT
Sam Sneddon [:gsnedders]
Comment 4 2025-01-02 10:06:32 PST
This is at least in part the same as the defer case, given the HTML spec defines the lazy processing under 'if el has a defer attribute or el's type is "module"' (https://html.spec.whatwg.org/multipage/scripting.html#:~:text=Otherwise%2C%20if%20el%20has%20a%20%20%20%20%20%20defer%20attribute%20or%20el's%20type%20is%20%22module%22:).
Note You need to log in before you can comment on or make changes to this bug.