Why doesn't Internet Explorer 11 honour condit

2019-01-03 23:17发布

I'm using the new Internet Explorer 11 developer tools to switch the document mode to "8", but conditional comments are still ignored, that is, they are not properly parsed and behave like normal comments. So any referenced file inside the conditional comment is not requested/loaded by the browser.

Why does this happen? Is it a bug?

If you think that this is indeed a bug that needs to be fixed, please go in and say that you too can reproduce this on the Microsoft bug report that is reported for this issue:
Conditional comments do not work when emulating document modes via F12 Developer Tools.

Update: This issue has been reported to be fixed in the mentioned bug report.

8条回答
趁早两清
2楼-- · 2019-01-03 23:55

This worked for me and seems like the most elegant/easy fix (Internet Explorer 10 and Internet Explorer 11 I guess are the only browsers that support -ms-high-contract):

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {  
   /* IE10+ specific styles go here */
}
查看更多
我命由我不由天
3楼-- · 2019-01-03 23:57

I recently ran into the same problem. I also found that some conditional comments work:

  • gt and lt worked fine
  • gte and lte never worked

So one potential solution would be to change the conditional statements to use the gt and lt operators.

The other alternative, which I found more useful, was to use a service like browserstack.

查看更多
登录 后发表回答