gpt4 book ai didi

javascript - 为什么自关闭脚本元素不起作用?

转载 作者:行者123 更新时间:2023-12-02 02:38:11 39 4
gpt4 key购买 nike

浏览器无法正确识别的原因是什么:

<script src="foobar.js" /> <!-- self-closing script element -->

只有这一点被认可:
<script src="foobar.js"></script>

这是否打破了 XHTML 支持的概念?

注意:此声明至少对所有 IE(6-8 beta 2)都是正确的。

最佳答案

XHTML 1 规范说:

С.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 (e.g. use <p> </p> and not <p />).



XHTML DTD将脚本元素指定为:
<!-- script statements, which may include CDATA sections -->
<!ELEMENT script (#PCDATA)>

关于javascript - 为什么自关闭脚本元素不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/392561/

39 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com