IE不正确解析HTML [英] IE not parsing HTML correctly

查看:138
本文介绍了IE不正确解析HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是在IE9中单击查看源之后查看的 HTML代码的快照。我在Notepad ++中打开了

Here's a snapshot of my HTML code as viewed after clicking View Source in IE9. I opens up in Notepad++

以下是IE9开发工具解析的代码:

Here is the code as parsed by the IE9's Developer Tool:

为什么两者之间有断开连接?

Why is there a disconnect between the two?

推荐答案

由于@Shadow Wizard在评论中建议,可能的原因是<!DOCTYPE之前的一些数据字符...> 声明。例如,通过获取有效的XHTML文档并在文档的最开始插入无中断空格字符(NBSP,U + 00A0)可以重现问题。但是,一开始,BOM的存在不会导致问题(至少不在IE 9上,几乎没有使用任何浏览器)。有大量隐形或几乎看不见的字符可能会导致问题。

As @Shadow Wizard suggested in a comment, the probable cause is some data character before the <!DOCTYPE ...> declaration. For example, the problem is reproducible by taking a valid XHTML document and inserting the no-break space character (NBSP, U+00A0) at the very start of the document. But the presence of a BOM at the start does not cause the problem (at least not on IE 9, hardly on any browser in use). There is a large number of invisible or barely visible characters that might cause the problem.

这篇关于IE不正确解析HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆