<无脚本>XML 文档中的处理无脚本>
据我所知
有人可以向我指出适当的 W3C 标准或提供任何其他说明吗?
附言。感兴趣的情况是使用
Is there any difference in <noscript> block processing for pages served with MIME-type text/html versus those served with MIME-type application/xhtml+xml?
As far as I noticed <noscript> block for text/html pages is not processed at all if JavaScript is disabled in browser. And what happens for application/xhtml+xml pages? I suspect that for such pages the block is still analysed when JavaScript is disabled. But I failed to find any clarification of this issue.
Could someone point me to appropriate W3C standard or provide any other clarification?
PS. Situation of interest is visit counting services wich use <noscript> block to track visitors with disabled JS. If elements (for example, zero-sized images) of <noscript> blocks are downloaded in any case then such services should broke :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好的描述可能是 HTML5 草案中的描述: http ://dev.w3.org/html5/spec/semantics.html#the-noscript-element。
在 text/html 中,具体发生的事情的细节非常复杂。只需点击上面的链接即可。在这里没有必要复制。
对于application/xhtml+xml,草案说:
所以在application/xhtml+xml中,无论是否有脚本,都应该显示noscript的内容。当然,如果启用了脚本,那么使用脚本从 DOM 中删除此类元素就非常简单了。
更正。
在进一步的研究中,我认为上面引用的意思是,noscript 元素对解析没有影响。
在此处的 XHTML 部分中, http:// dev.w3.org/html5/spec/the-xhtml-syntax.html#the-xhtml-syntax,草案说
因此,正如您所说,当启用脚本时, noscript 元素会隐藏其内容。然而,这就是它所做的一切,并且无论如何都会加载图像。另外,我尝试了这个:
虽然noscript节点已从dom中删除,但Firefox仍然尝试加载图像。
The best description is probably the one in the HTML5 draft here : http://dev.w3.org/html5/spec/semantics.html#the-noscript-element.
In text/html, the details of exactly what happens are quite complex. Just follow the link above. No point in reproducing here.
For application/xhtml+xml, the draft says:
So in application/xhtml+xml, the contents of noscript should be displayed regardless of whether scripting is available or not. Of course, if scripting is enabled, it's pretty trivial to use script to remove such elements from the DOM.
CORRECTION.
On further research, what the above quote means I think, is that the noscript element has no effect on the parsing.
In the XHTML section here, http://dev.w3.org/html5/spec/the-xhtml-syntax.html#the-xhtml-syntax, the draft says
So, as you say, when scripting is enabled the noscript element does hide its contents. However, that's all it does, and images are loaded anyway. In addition, I tried this:
And although the noscript node is removed from the dom, Firefox still tried to load the image.