Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

html - Will IE9 support conditional comments?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...