HTML – Content-Script-Type和Content-Style-Type的重点是什么

考虑以下两行:

Scripting的W3文档,在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

然而它在Local declaration of a scripting language继续说:

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.

在我看来,这里有一个过度规范.为什么需要meta和per-script类型声明?如果我们“必须”单独声明每个标签,那么强制性默认的重点是什么?

让默认值为默认值,或者只是声明每个标签需要它自己的类型 – 或者这里的措辞只是让我绊倒?参考style sheets也使用相同的语言.

最佳答案
< script>和< style>元素只是向HTML添加脚本和样式的一种方式.

对于脚本,我们有事件处理程序属性,为样式HTML 4.01定义< link> element,Link:HTTP标头和“style”属性.在每种情况下,都没有强制指定语言,因此后退将是Content-Script-Type和Content-Style-Type的值.

例如:脚本部分说:

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.

和造型部分有一个等同的声明:

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”.

请注意,这些要求不是DTD可表达的,因此依赖于DTD的验证器不会将违规标记为错误.

是否有任何浏览器实际关注设置,我不知道.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


html5中section的用法
span标签和p标签的区别
jsp文件和html文件的区别是什么
span标签和div的区别
html颜色代码表大全
span标签的作用是什么
dhtml的主要组成部分包括什么
html编辑器哪个软件好用
span标签属于什么样式标签
html文件乱码怎么办
html怎么读取json文件
html文件打开乱码怎么恢复原状
html怎么链接外部css
html文件怎么保存到本地
html怎么链接css文件
html和css怎么连接
html和css怎么关联
html文件怎么保存到一个站点
html文件怎么写
html出现乱码怎么解决