IE9支持条件注释吗?
我想我记得在某处读到过 IE9 不 支持它们,但现在搜索后我找不到任何迹象表明这是真的。
有谁知道 Microsoft 是否会在 IE9 中支持条件注释的明确声明?
I thought I remembered reading somewhere that IE9 would not be supporting them, but now after searching I can't find any indication that this is true.
Is anyone aware of a definitive statement, either way, about whether Microsoft will be supporting conditional comments in IE9?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Platform Preview 支持它们,启动它(或下载它,然后启动它)并查看此示例 - http:// jsbin.com/axaju3:
在 IE 9 文档模式下测试。
来自 IE 团队的 EricLaw 在下面的评论中直接证实了 CC 在 IE9 中仍然可用。
IE 博客上的最新帖子 表明,作为获得一致的跨浏览器 HTML5 解析的一部分,条件注释在 IE10 的渲染引擎中将不起作用:
从 Platform Preview 2 开始确实如此,作者建议您应该使用功能检测作为替代方案。
The Platform Preview supports them, fire it up (or download it, then fire it up) and see this example - http://jsbin.com/axaju3:
Tested in IE 9 Document Mode.
Straight from the horse's mouth, EricLaw from the IE team has confirmed in the comments below that CCs are still available in IE9.
A recent post on the IE blog shows that, as part of the effort to get consistent cross-browser HTML5 parsing, conditional comments will not work in IE10's rendering engine:
This is true as of Platform Preview 2 and the author suggests you should use feature detection as an alternative.
Internet Explorer 9 将是支持条件注释的最后版本。随着 Internet Explorer 10 的发布,微软正在翻开新的一页。根据 MSDN 文章条件注释< /a>:
虽然这不会影响大多数在线网站,但有可能会影响您的网站。如果是这样,请考虑使用 x-ua 兼容的元标记或标头来指示 Internet Explorer 模拟 Internet Explorer 9(支持条件注释的最后版本):
请注意,这将阻止您访问最新版本浏览器的功能,例如对 HTML5 和 CSS3 的更广泛支持,以及更多 JavaScript API。
最好的解决办法是戒掉有条件的评论。借助 Internet Explorer 10,Microsoft 浏览器的运行方式将开始与其他流行浏览器大致相同,无需过多关注编写特定于 IE 的代码,并且完全不需要条件注释。
条件注释并不是 IE10 中唯一被废弃的东西。 还有更多。
Internet Explorer 9 will be the last version to support conditional comments. With the release of Internet Explorer 10, Microsoft is turning over a new leaf. According to the MSDN article on Conditional Comments:
While this will not affect the majority of sites online, there's a chance it may affect yours. If it does, please consider making use of the x-ua-compatible meta tag or header to instruct Internet Explorer to Emulate Internet Explorer 9 (the last version to support conditional comments):
Note that this will prevent you from having access to the newest features of the browser, like broader support for HTML5, and CSS3, as well as more JavaScript APIs.
The best solution is to ween yourself off of conditional comments. With Internet Explorer 10, Microsoft's browser will begin to operate much the same way other popular browsers do, requiring less attention to writing IE-specific code, as well as removing the need for conditional comments altogether.
Conditional Comments aren't the only thing to become obsolete in IE10. There's more.
我相信这是必须的,否则大量的网站会同时崩溃,而为 IE9 做这样的启动并不符合微软的最佳利益。
如果存在某种兼容模式,那么该模式可能支持条件注释,但“纯 IE9”不支持。
PS 只是猜测。
I believe it will have to, otherwise a huge amount of sites will break all at once and it's not in the best Microsoft's interests to make that sort of start for IE9.
If there is going to be some sort of compatibility mode, then it is possible conditional comments will be supported in this mode but not in "pure IE9".
P.S. Just speculations.