Domenic Denicola wrote:
From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Brendan
Eich
> Examples? What is the specified grammar?
> From [the HTML spec][1]:
> The `type` attribute gives the language of the script or format of the data. If the
attribute is present, its value must be a [valid MIME type][2]. The `charset` parameter must
not be specified. The default, which is used if the attribute is absent, is
`"text/javascript"`.
Then there's a bunch of other text regarding how the `type` attribute translates into
MIME types and how mime types end up translating to "supported scripting
languages", ending up at [3].
---
My understanding of what's been specified here, codified from legacy, is that browsers
(since the dawn of time) always interpreted either missing `type` attribute or
"text/javascript" as instructions to execute JavaScript code, and most other
things as inert and ignored.
Right, that doesn't mean the type can be any old string and have new
meaning, though. More the reverse.
There's a bit of a gray area involving all the other "aliases" for
text/javascript, e.g. some older browsers probably don't support text/livescript, while
others probably don't support text/jscript.
Those are long dead. RFC 4329 defines properly registered IANA media
types, application/javascript and application/ecmascript. The
text/javascript misnomer was created without being registered by Dave
Raggett for HTML4. It is shorter than application/javascript, so hard to
kill now. But at least it's a media type.
The upside is that, as Arv says, you can put any string you want in there, and
browsers will cope just fine by ignoring it unless it's one of the specific
types that maps to JavaScript per [3].
Yes, this is part of the fail-soft nature of HTML. But it does not mean
the HTML grammar allows anything for specified cases -- in fact for
those as you say, it requires an IANA media type. Old content on the web
could today use module and count on content being ignored (not that I
know of any, or think this is likely).
Defining new types should follow the rules, not just extend the domain
of type to random strings we think we can get away with.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss