aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/traversing.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js
index 74da6d973..c7ed01415 100644
--- a/test/unit/traversing.js
+++ b/test/unit/traversing.js
@@ -481,6 +481,20 @@ QUnit.test( "not(Selector) excludes non-element nodes (gh-2808)", function( asse
assert.deepEqual( mixedContents.not( "[id=a],*,[id=b]" ).get(), [], "not [id=a],*,[id=b]" );
} );
+QUnit.test( "not(arraylike) passes non-element nodes (gh-3226)", function( assert ) {
+ assert.expect( 5 );
+
+ var mixedContents = jQuery( "<span id='nonnodesElement'>hi</span> there <!-- mon ami -->" ),
+ mixedLength = mixedContents.length,
+ firstElement = mixedContents.first();
+
+ assert.deepEqual( mixedContents.not( mixedContents ).get(), [], "not everything" );
+ assert.deepEqual( mixedContents.not( firstElement ).length, mixedLength - 1, "not firstElement" );
+ assert.deepEqual( mixedContents.not( [ firstElement[ 0 ].nextSibling ] ).length, mixedLength - 1, "not textnode array" );
+ assert.deepEqual( mixedContents.not( firstElement[ 0 ].nextSibling ).length, mixedLength - 1, "not textnode" );
+ assert.deepEqual( mixedContents.not( document.body ).get(), mixedContents.get(), "not with unmatched element" );
+} );
+
QUnit.test( "has(Element)", function( assert ) {
assert.expect( 3 );
var obj, detached, multipleParent;