RESOLVED FIXED Bug 161651
[WebCore] Clean up script loading code in XML
https://bugs.webkit.org/show_bug.cgi?id=161651
Summary [WebCore] Clean up script loading code in XML
Yusuke Suzuki
Reported 2016-09-06 15:41:23 PDT
...
Attachments
Patch (6.97 KB, patch)
2016-11-16 20:12 PST, Yusuke Suzuki
no flags
Patch (25.54 KB, patch)
2016-11-16 22:06 PST, Yusuke Suzuki
rniwa: review+
Yusuke Suzuki
Comment 1 2016-11-16 20:12:09 PST
Created attachment 295022 [details] Patch WIP
Yusuke Suzuki
Comment 2 2016-11-16 22:06:35 PST
Ryosuke Niwa
Comment 3 2016-11-16 22:21:50 PST
Comment on attachment 295028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review > Source/WebCore/dom/ScriptElement.cpp:167 > + // XHTML document does not support "defer" attribute semantics. > + // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document. Is this behavior spec compliant!?
Yusuke Suzuki
Comment 4 2016-11-16 22:32:36 PST
Comment on attachment 295028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review >> Source/WebCore/dom/ScriptElement.cpp:167 >> + // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document. > > Is this behavior spec compliant!? XHTML defines "defer" attribute. But WebKit does not implement it for a long time. Once "defer" is implemented, we can reconsider enabling modules in XHTML. But I'm not sure that's worth doing (implementing defer semantics and enabling modules in XHTML). Since "defer" semantics is not implemented, before this patch, we just ignore the modules in XHTML document. But it causes some strange behavior. For example, if you write <script type="module"> in document, it is ignored. But if you create script tag with `type="module"` dynamically, it works. To make it consistent, I think disabling modules until "defer" is implemented in XHTML is better. I'll note the above description in this comment.
Yusuke Suzuki
Comment 5 2016-11-16 22:38:30 PST
Comment on attachment 295028 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=295028&action=review >>> Source/WebCore/dom/ScriptElement.cpp:167 >>> + // And module tag also uses defer attribute semantics. We disable script type="module" for non HTML document. >> >> Is this behavior spec compliant!? > > XHTML defines "defer" attribute. But WebKit does not implement it for a long time. > Once "defer" is implemented, we can reconsider enabling modules in XHTML. But I'm not sure that's worth doing (implementing defer semantics and enabling modules in XHTML). > > Since "defer" semantics is not implemented, before this patch, we just ignore the modules in XHTML document. But it causes some strange behavior. > For example, if you write <script type="module"> in document, it is ignored. But if you create script tag with `type="module"` dynamically, it works. > To make it consistent, I think disabling modules until "defer" is implemented in XHTML is better. > > I'll note the above description in this comment. We have a bug for that https://bugs.webkit.org/show_bug.cgi?id=123387. I'll paste this URL. According to that bug, blink intentionally does not support it https://bugs.chromium.org/p/chromium/issues/detail?id=611136.
Yusuke Suzuki
Comment 6 2016-11-16 22:47:38 PST
Note You need to log in before you can comment on or make changes to this bug.