IE是唯一需要< script>< / script>的网络浏览器和讨厌< script />? [英] Is IE the only web browser that requires <script></script> and hates <script/>?
问题描述
经过一个小时的狩猎和啄食之后,我觉得我还可能为世界贡献一个可怕的事实,即你的javascript无法在IE中工作的唯一原因是因为你认为你可以快速推出一个在它上面使用你喜欢的xHTML快捷方式。
How awful is that, after an hour of hunting and pecking, I figured I might as well contribute to the world the awful truth that the only reason your javascript failed to work in IE is because you thought you could pull a fast one on it and use your fancy xHTML shortcut.
我是阅读dtd ,我真的找不到任何IE的基础如此持久性。
I've read the dtd and I can't really find any basis for IE being so persnickity.
推荐答案
你没有使用xhtml,你使用的是html,html不支持xml的自闭标签语法 - 在html中使用自闭标签语法将导致元素放置在元素上,而不是关闭标签。
You're not using xhtml, you're using html, and html does not support the self closing tag syntax of xml -- in html using the self closing tag syntax will result in an attribute '/' being place on the element, not in closing the tag.
现在取决于上下文< script>
标记的浏览器通常会更正这一点,因此您实际上依赖浏览器自动更正来使一切正常工作。
Now depending on the context of the <script>
tag the browsers will typically correct this, so you're in effect relying on the browsers autocorrection to make everything work properly.
这篇关于IE是唯一需要< script>< / script>的网络浏览器和讨厌< script />?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!