HTML Script Element
I'm working on a little cookbook of useful HTML scripts, and all of them obviously include <script> tags. Typically this looks like this:
[cc lang="html"]
[/cc]
There was a time when you needed to hide the script from browsers that didn't understand the script tag, and would therefore ignore it and show the text inside as if it was undecorated. That looked like this:
[cc lang="html"]
[/cc]
Fortunately no browser in common use today requires this.
And, as I discovered, the type attribute also seems to be no longer required, even though it's almost always specified. The HTML 4.01 specification is clear on the point that it is required:
type = content-type [CI]
This attribute specifies the scripting language of the element's contents and overrides the default scripting language. The scripting language is specified as a content type (e.g., "text/javascript"). Authors must supply a value for this attribute. There is no default value for this attribute.
However, every browser supported by BrowserLab uses JavaScript as the default value, and the HTML5 specification actually clarifies this:
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. The charset parameter must not be specified. The default, which is used if the attribute is absent, is "text/javascript".
Which means, from now going forward, we can all use an undecorated script tag:
[cc lang="html"]
[/cc]
That's a pretty nice little change.