Javascript jQuery.not()选择器不使用类

Javascript jQuery.not()选择器不使用类,javascript,jquery,jquery-selectors,Javascript,Jquery,Jquery Selectors,我正在尝试选择body的所有直接子级,但与某个类匹配的子级除外 无论我使用.not()过滤器还是:not()选择器,当我按类名过滤时,我尝试过滤掉的元素仍然是选择的一部分。但是,如果我尝试根据它的id过滤掉它,它就可以正常工作 以下是选择器: console.log( $( 'body > *' ).not( '.fullscreen, script' ) ); // div.fullscreen is STILL part of the selection cons

我正在尝试选择
body
的所有直接子级,但与某个类匹配的子级除外

无论我使用
.not()
过滤器还是
:not()
选择器,当我按类名过滤时,我尝试过滤掉的元素仍然是选择的一部分。但是,如果我尝试根据它的id过滤掉它,它就可以正常工作

以下是选择器:

    console.log( $( 'body > *' ).not( '.fullscreen, script' ) );    // div.fullscreen is STILL part of the selection
    console.log( $( 'body > *' ).not( '#searchWindow, script' ) );  // div.fullscreen is gone, like I wanted
    console.log( $( 'body > *:not(.fullscreen, script)' ) );    // div.fullscreen is STILL part of the selection
    console.log( $( 'body > *:not(#searchWindow, script)' ) );  // div.fullscreen is gone, like I wanted
为什么在这种情况下,类选择器无效


这是一个。

您在HTML中拼写的
全屏
错误。它有三个
l

请看这里:

<div id="searchWindow" class="fulllscreen">


因为你没有
div.fullscreen
,所以它是
div.fullscreen
我可以理解反对票,但问愚蠢问题的政策是什么?现在我意识到我的错误了,我应该删除我的问题吗?我们通常会关闭它们,但我不确定那些有答案的会不会自己消失。这太好笑了。编码错误再次出现。谢谢@FabienSnauwaert如果我每犯一个编码拼写错误就有10个代表,我就会打败Jon Skeet:)。不用担心,很高兴你把它整理好了。