diff options
author | Martijn W. van der Lee <martijn@vanderlee.com> | 2016-01-11 20:59:33 +0100 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2016-01-13 13:33:01 -0500 |
commit | 0e2f8f9effd2c95647be534bf9055e099aad7cfd (patch) | |
tree | d4e3ef74d8d4b861ea1090a8a829ae133ecbd2f8 /test | |
parent | b0b280cd61d1fa12b67bd723ac2c2fa91b92db01 (diff) | |
download | jquery-0e2f8f9effd2c95647be534bf9055e099aad7cfd.tar.gz jquery-0e2f8f9effd2c95647be534bf9055e099aad7cfd.zip |
Traversing: .not/.filter consistency with non-elements
Fixes gh-2808
Close gh-2809
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/traversing.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 7766fd3cb..d38d40be5 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -430,6 +430,17 @@ QUnit.test( "not(jQuery)", function( assert ) { assert.deepEqual( jQuery( "p" ).not( jQuery( "#ap, #sndp, .result" ) ).get(), q( "firstp", "en", "sap", "first" ), "not(jQuery)" ); } ); +QUnit.test( "not(Selector) excludes non-element nodes (gh-2808)", function( assert ) { + assert.expect( 3 ); + + var mixedContents = jQuery( "#nonnodes" ).contents(), + childElements = q( "nonnodesElement" ); + + assert.deepEqual( mixedContents.not( "*" ).get(), [], "not *" ); + assert.deepEqual( mixedContents.not( "[id=a],[id=b]" ).get(), childElements, "not [id=a],[id=b]" ); + assert.deepEqual( mixedContents.not( "[id=a],*,[id=b]" ).get(), [], "not [id=a],*,[id=b]" ); +} ); + QUnit.test( "has(Element)", function( assert ) { assert.expect( 3 ); var obj, detached, multipleParent; |