I'd like to rewrite markup in the tree to avoid using the [type] attribute on 
<script> tags when it's unnecessary. This attribute often causes the script tag 
to wrap to another line and generally causes extra boilerplate, especially in 
tests (for example 
https://searchfox.org/mozilla-central/rev/8d78f219702286c873860f39f9ed78bad1a6d062/dom/base/test/chrome/test_bug206691.xul#10-11)

I'm writing to the list in order to:
1) See if there are any potential issues with this making change, other than 
making sure that it doesn’t apply to tests that are specifically testing the 
[type] attribute (and if anyone has pointers to tests doing that it would be 
quite helpful).
2) See if there are any general best-practices for getting this type of change 
reviewed / landed. For example, should we prefer separate commits / reviews per 
directory, or does a single tree-wide commit make sense?

I've prepared a script that rewrites this across the tree. The script and the 
generated patch can be seen at 
https://bugzilla.mozilla.org/show_bug.cgi?id=1542877. The following directories 
are excluded:

- third_party
- testing/web-platform: I've excluded this because (a) I expected there would 
be tests that are specifically checking behavior for scripts with different 
[type] attributes and (b) I wasn't sure if we'd want to upstream this change. 
It could be included if that’s wrong.

More context: the type attribute is unnecessary on script tags if it's one of 
the following strings (from 
https://searchfox.org/mozilla-central/rev/8d78f219702286c873860f39f9ed78bad1a6d062/dom/base/nsContentUtils.cpp#6994-7009):

- "text/javascript"
- "text/ecmascript"
- "application/javascript"
- "application/ecmascript"
- "application/x-javascript"
- "application/x-ecmascript"
- "text/javascript1.0"
- "text/javascript1.1"
- "text/javascript1.2"
- "text/javascript1.3"
- "text/javascript1.4"
- "text/javascript1.5"
- "text/jscript"
- "text/livescript"
- "text/x-ecmascript"
- "text/x-javascript"

And we use the following in either xul, xhtml, or html files in tree:

- "text/javascript"
- "text/ecmascript"
- "application/javascript"
- "application/ecmascript"
- "application/x-javascript"

Thanks,
Brian

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to