Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Add .is() DOM Filter #65

Closed
wants to merge 1 commit into from
Closed

Add .is() DOM Filter #65

wants to merge 1 commit into from

Conversation

Wikiki
Copy link
Contributor

@Wikiki Wikiki commented May 21, 2017

add .is( selector) to filter collection
selector can be a DOM element, a DOMtastic instance or a string.

Take into account extended selector :visible :hidden

add .is( selector) to filter collection
selector can be a DOM element, a DOMtastic instance or a string.

Take into account extended selector :visible :hidden
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.6%) to 89.754% when pulling 8ff56e5 on Wikiki:feature/isSelectorDOMFiltering into e0991e2 on webpro:master.

@webpro
Copy link
Owner

webpro commented May 26, 2017

The is method sounds like a method that tries to do too much. FYI, there is a matches function that works like this:

$.matches(element, '.b')

Or, you can check a class, e.g.:

$('.a').hasClass('b');

The latter can be modified to cater for the first. For a DOMtastic instance, there is:

const $element = $(document);
$element === $(element);

For a DOM element, you could do:

const element = document.body;
$(element).get(0) === element; // or:
$(element)[0] === element;

How about extending matches so we can do this:

$('.a').matches('.b')

We could then only pass a selector, though.

@Wikiki
Copy link
Contributor Author

Wikiki commented May 28, 2017

Hi,

thank for your answer but my point is more related to the chainability.
How to maintain the chainability with your proposales ?

Regards

@webpro
Copy link
Owner

webpro commented Jul 5, 2017

Could you please elaborate on your use case? In which situation are you missing the chainability?

@webpro
Copy link
Owner

webpro commented Oct 22, 2017

Closing this one due to inactivity.

@webpro webpro closed this Oct 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants