Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/419.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在旧浏览器中检测css pseudo:empty?_Javascript_Css_Internet Explorer_Html5boilerplate - Fatal编程技术网

Javascript 如何在旧浏览器中检测css pseudo:empty?

Javascript 如何在旧浏览器中检测css pseudo:empty?,javascript,css,internet-explorer,html5boilerplate,Javascript,Css,Internet Explorer,Html5boilerplate,我希望在某些图例控件为空时清除其背景,但我的应用程序目标是IE7及以上版本 我一直在研究这个,而且:空切为我,但它只适用于IE9+ 因此,我必须通过javascript模拟我的css,我有以下代码: if ($('html').hasClass('lt-ie9')) { $("legend:empty,h3:empty") .css("background-color", "transparent") .height(16);

我希望在某些图例控件为空时清除其背景,但我的应用程序目标是IE7及以上版本

我一直在研究这个,而且:空切为我,但它只适用于IE9+

因此,我必须通过javascript模拟我的css,我有以下代码:

   if ($('html').hasClass('lt-ie9')) {
        $("legend:empty,h3:empty")
            .css("background-color", "transparent")
            .height(16); // make equal to newstyles.css
    }
我正在使用Modernizer和HTML5样板

因此,这段代码似乎工作正常,但在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.有没有办法通过Modernizer检测到这一点


谢谢

如何使用jquery并让它处理浏览器的差异,例如,这正是我正在使用的,但是,如果浏览器已经可以处理它,我尝试不应用jquery这可能会帮助您。。。太脆弱了,因为lang可能在IE8+中工作,感谢您的输入