Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the point of Content-Script-Type and Content-Style-Type

Consider these two lines:

<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />

From the W3's documentation on Scripting, in the section The default scripting language:

Authors should specify the default scripting language for all scripts in a document by including the following META declaration in the HEAD

Yet it continues in Local declaration of a scripting language to say:

The type attribute must be specified for each SCRIPT element instance in a document. The value of the type attribute for a SCRIPT element overrides the default scripting language for that element.

Seems to me like there's an over-specification here. Why are both the meta and per-script type declarations required? What's the point of a mandatory default if we 'must' declare each tag individually anyway?

Either let the default be the default, or just state that each tag needs it's own type - or is the wording here just getting me tripped up? The same language is used with reference to style sheets as well.

like image 301
Chris Tonkinson Avatar asked Jun 07 '11 16:06

Chris Tonkinson


1 Answers

The <script> and <style> elements are only one way of adding scripting and styling to HTML.

For scripting, we have event handler attributes, for styling HTML 4.01 defines the <link> element, the Link: HTTP header and the "style" attribute. In each of these cases, specifying the language is not mandated, so the fall-back would be the value of Content-Script-Type and Content-Style-Type.

For example: the scripting section says:

Documents that do not specify default scripting language information and that contain elements that specify an intrinsic event script are incorrect. User agents may still attempt to interpret incorrectly specified scripts but are not required to. Authoring tools should generate default scripting language information to help authors avoid creating incorrect documents.

and the styling section has an equivalent statement:

Documents that include elements that set the style attribute but which don't define a default style sheet language are incorrect. Authoring tools should generate default style sheet language information (typically a META declaration) so that user agents do not have to rely on a default of "text/css".

Note that these requirements are not DTD expressable, so validators that rely on a DTD won't flag violations as errors.

Whether any browser actually pays any attention to the settings, I've no idea.

like image 59
Alohci Avatar answered Oct 31 '22 02:10

Alohci