RESOLVED FIXED149576
[ES6] Add ScriptElement::determineScriptType
https://bugs.webkit.org/show_bug.cgi?id=149576
Summary [ES6] Add ScriptElement::determineScriptType
Yusuke Suzuki
Reported 2015-09-25 16:01:05 PDT
[ES6] Add isModuleType function to ScriptElements
Attachments
Patch (5.14 KB, patch)
2015-09-25 16:04 PDT, Yusuke Suzuki
no flags
Patch (3.08 KB, patch)
2015-09-26 01:01 PDT, Yusuke Suzuki
no flags
Patch (3.53 KB, patch)
2016-08-05 01:53 PDT, Yusuke Suzuki
no flags
Patch (3.54 KB, patch)
2016-08-05 02:07 PDT, Yusuke Suzuki
no flags
Patch (5.07 KB, patch)
2016-08-05 02:25 PDT, Yusuke Suzuki
no flags
Patch (4.93 KB, patch)
2016-08-05 02:37 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2015-09-25 16:04:21 PDT
Ryosuke Niwa
Comment 2 2015-09-25 23:52:55 PDT
Comment on attachment 261951 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=261951&action=review > Source/WebCore/dom/ScriptElement.cpp:165 > + else if (type == "module") Where is this type value specified? I can't find any mentioning of the "module" type in https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type or https://html.spec.whatwg.org/multipage/infrastructure.html#valid-mime-type Also, shouldn't this check for the type of the element given SVGScriptElement doesn't support modules? > Source/WebCore/html/HTMLScriptElement.cpp:171 > +bool HTMLScriptElement::isModuleType() const > +{ > +#if ENABLE(ES6_MODULES) > + return fastGetAttribute(typeAttr).string() == "module"; > +#else > + return false; > +#endif > +} I think it's better to put this in ScriptElement so that checks for "module" type appears next to each other.
Yusuke Suzuki
Comment 3 2015-09-26 00:42:22 PDT
Comment on attachment 261951 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=261951&action=review Thank you for your comment! >> Source/WebCore/dom/ScriptElement.cpp:165 >> + else if (type == "module") > > Where is this type value specified? I can't find any mentioning of the "module" type in > https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type > or > https://html.spec.whatwg.org/multipage/infrastructure.html#valid-mime-type > > Also, shouldn't this check for the type of the element given SVGScriptElement doesn't support modules? This is why the module tag is behind the compile time flag. Currently, there is consensus, but not specified yet. https://github.com/whatwg/loader/blob/master/roadmap.md#stage-0-basic-static-loading https://github.com/whatwg/loader/issues/83#issuecomment-143219400 https://github.com/dherman/module-tag/blob/master/explainer.md https://esdiscuss.org/topic/any-news-about-the-module-element And oops, I've missed it. After thinking about it, I think enabling "module" for svg script element seems more consistent. So, I'll drop the SVGScriptElement's change. Put all "module" related changes into ScriptElement. >> Source/WebCore/html/HTMLScriptElement.cpp:171 >> +} > > I think it's better to put this in ScriptElement so that checks for "module" type appears next to each other. Looks very nice to me.
Yusuke Suzuki
Comment 4 2015-09-26 01:01:20 PDT
Ryosuke Niwa
Comment 5 2015-09-26 01:13:19 PDT
Okay, why don't we wait until those discussion settle? We can implement the other parts of the module loading without this, right? e.g. @import inside a script element.
Yusuke Suzuki
Comment 6 2015-09-26 01:21:41 PDT
(In reply to comment #5) > Okay, why don't we wait until those discussion settle? We can implement the > other parts of the module loading without this, right? e.g. @import inside > a script element. Pending this patch is OK to me :-) I'll do the other parts first, like https://bugs.webkit.org/show_bug.cgi?id=149574.
Yusuke Suzuki
Comment 7 2016-08-05 00:05:40 PDT
Let's reboot this. The description about type="module" is explicitly specified in the whatwg living standard! https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system
Yusuke Suzuki
Comment 8 2016-08-05 01:53:40 PDT
Yusuke Suzuki
Comment 9 2016-08-05 02:07:18 PDT
Yusuke Suzuki
Comment 10 2016-08-05 02:25:17 PDT
Yusuke Suzuki
Comment 11 2016-08-05 02:37:15 PDT
Saam Barati
Comment 12 2016-08-05 11:47:47 PDT
Comment on attachment 285415 [details] Patch LGTM but I'll let other WebCore reviewers give the official review
Yusuke Suzuki
Comment 13 2016-08-05 23:09:03 PDT
Comment on attachment 285415 [details] Patch Thanks!
WebKit Commit Bot
Comment 14 2016-08-05 23:29:47 PDT
Comment on attachment 285415 [details] Patch Clearing flags on attachment: 285415 Committed r204221: <http://trac.webkit.org/changeset/204221>
WebKit Commit Bot
Comment 15 2016-08-05 23:29:55 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.