Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

javascript - 自关闭脚本元素为何不起作用?(Why don't self-closing script elements work?)

What is the reason browsers do not correctly recognize:(浏览器无法正确识别的原因是什么:)

<script src="foobar.js" /> <!-- self-closing script element --> Only this is recognized:(只有这是公认的:) <script src="foobar.js"></script> Does this break the concept of XHTML support?(这是否打破了XHTML支持的概念?) Note: This statement is correct at least for all IE (6-8 beta 2).(注意:此声明至少对所有IE(6-8 beta 2)都是正确的。)   ask by dimarzionist translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

XHTML 1 specification says:(XHTML 1规范说:)

С.3.(С.3。) Element Minimization and Empty Element Content(元素最小化和空元素内容) Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (eg use <p> </p> and not <p /> ).(给定内容模型不是EMPTY的元素的空实例(例如,空的标题或段落),请不要使用最小化形式(例如,使用<p> </p>而不是<p /> )。) XHTML DTD specifies script elements as:(XHTML DTD将脚本元素指定为:) <!-- script statements, which may include CDATA sections --> <!ELEMENT script (#PCDATA)>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...