[英]querySelectorAll ":not" doesn't work in IE8, does jQuery's version?
不幸的是,我必须支持 IE8 并且需要使用:not
修饰符来选择输入。 我知道 IE8 在querySelectorAll
中不支持这个,但是 jQuery 的版本是否支持 IE8 呢?
查询选择器All:
domElement.querySelectorAll( "input:not([name*='[statistic]']):not([type=button]),textarea:not([name*='[statistic]'])" );
jQuery:
jQuery( "input:not([name*='[statistic]']):not([type=button]),textarea:not([name*='[statistic]'])", domElement );
简短的回答:是的。
首先让 jQuery 流行的主要因素之一是它允许旧浏览器支持新的选择器,如:not
。
所以是的,您将能够在 jQuery 代码中使用:not
和其他选择器。
您不能在 IE8 中将:not
与querySelectorAll()
,因为 IE8 根本不支持它。 IE8 支持 CSS2.1,它是发布时的当前标准。 :not
只是不在图片中。 并且您根本无法在较旧的 IE 版本中使用querySelectorAll()
。
jQuery 是专门为处理这些问题而创建的,它允许开发人员支持较旧的 IE 版本,同时仍然允许我们使用现代浏览器功能。
今天可能有人说你不再需要 jQuery,但如果你需要支持旧的 IE 版本,那么对 jQuery 的需求和往常一样多。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.