如何检测css pseudo:在旧浏览器中为空?

时间:2013-10-30 19:56:18

标签: javascript css internet-explorer html5boilerplate

我想清除一些传奇控件的背景,只要它们是空的,但我的应用程序的目标是IE7及以上版本。

我一直在研究这个问题,并且:对我来说是空的,但它只适用于IE9 +。

所以我必须通过javascript模拟我的css,我的代码如下:

   if ($('html').hasClass('lt-ie9')) {
        $("legend:empty,h3:empty")
            .css("background-color", "transparent")
            .height(16); // make equal to newstyles.css
    }

我正在使用Modernizr和Html5Boilerplate。

所以这段代码似乎工作正常,但在IE9标准模式下,我仍然得到了来自这个提取的lt-ie9类:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--><html class="no-js" xmlns="http://www.w3.org/1999/xhtml"><!--<![endif]-->
<HEAD>

所以我的问题是: 1.为什么IE9仍然有这个标签? 2.有没有办法通过Modernizr来检测这个?

谢谢!

0 个答案:

没有答案