IE9会支持条件注释吗? [英] Will IE9 support conditional comments?

查看:226
本文介绍了IE9会支持条件注释吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b我以为我记得在某处读到IE9不会支持他们,但是现在搜索后我找不到任何迹象表明这是真的。 $ b

是否有人知道关于微软是否会在IE9中支持条件注释的权威性声明?

平台预览版支持它们,启动它(或下载它,然后启动它)并查看此示例 - http:/ /jsbin.com/axaju3

 <! -  [if IE 9]> 
< p>您正在使用IE 9< / p>
<![endif] - >

在IE 9文档模式下测试。

直接从马的嘴里,IE团队的EricLaw已经在下面的评论中证实,CC仍然可以在IE9上使用。






IE博客最近的一篇文章显示,为了获得一致的跨浏览器HTML5解析,条件注释在IE10的渲染引擎中不起作用: p>

 <! -  [if IE]> 
此内容在IE10和其他浏览器中被忽略。
在旧版IE中,它呈现为页面的一部分。
<![endif] - >

平台预览版2的确如此,作者建议您应该使用功能检测作为替代方案。

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?

解决方案

The Platform Preview supports them, fire it up (or download it, then fire it up) and see this example - http://jsbin.com/axaju3:

<!--[if IE 9]>
    <p>You are using IE 9</p>
<![endif]-->

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:

<!--[if IE]>
This content is ignored in IE10 and other browsers.
In older versions of IE it renders as part of the page.
<![endif]-->

This is true as of Platform Preview 2 and the author suggests you should use feature detection as an alternative.

这篇关于IE9会支持条件注释吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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