Skip to content

Conversation

@dmethvin
Copy link
Member

@dmethvin dmethvin commented Aug 2, 2016

Summary

Fixes gh-3226, was only +3 gzip.

The docs at http://api.jquery.com/not/ might need some wording changes to clarify that this is intended behavior?

Checklist

Mark an [x] for completed items, if you're not sure leave them unchecked and we can assist.

@mention-bot
Copy link

@dmethvin, thanks for your PR! By analyzing the annotation information on this pull request, we identified @timmywil, @markelog and @gibson042 to be potential reviewers


assert.deepEqual( mixedContents.not( mixedContents.get() ).get(), [], "not everything" );
assert.deepEqual( mixedContents.not( childElements ).length, mixedLength - 1, "not childElements" );
assert.deepEqual( mixedContents.not( [ childElements[ 0 ].nextSibling ] ).length, mixedLength - 1, "not textnode" );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions on more rigorous tests are welcome, these seem a bit clumsy but of course it's never fun to manipulate non-element nodes in jQuery.

Copy link
Member

@markelog markelog Aug 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is very fragile test, since it doesn't use generated fixtures.

Beside that, sounds like we need to test explicitly all node types? At least text and comment, maybe processing node too, not sure if we need to test/support deprecated nodes though.

It would be cool if it would be shown explicitly either through the code or with comment or through assertion name

@markelog
Copy link
Member

markelog commented Aug 2, 2016

Maybe another test exactly like from the ticket should be added too? http://jsbin.com/yobuhucife/1/edit?html,js,output

hm, can it break user code? It seems it can :/. Hopefully not in the big way

}
if ( typeof qualifier !== "string" ) {
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional parentheses are not required? Either way is good though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, i see we already use it like that, couple lines down

if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
// Arraylike of elements (jQuery, arguments, Array)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you

@dmethvin dmethvin closed this in 560c0c6 Aug 10, 2016
@dmethvin dmethvin deleted the 3226-not branch September 12, 2017 19:52
@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

.not(arrayLike) shouldn't restrict results to elements

5 participants