Skip to content

Add boolean matches(String selectors) method#10314

Open
Greunlis wants to merge 1 commit intogwtproject:mainfrom
Greunlis:AIS_49
Open

Add boolean matches(String selectors) method#10314
Greunlis wants to merge 1 commit intogwtproject:mainfrom
Greunlis:AIS_49

Conversation

@Greunlis
Copy link
Copy Markdown

I propose adding a matches method as defined here: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches

@niloc132
Copy link
Copy Markdown
Member

Thanks for the submission - at the very least, we would want to have tests to accompany it. I would also be concerned about a caller who cannot tell if "false" means "doesn't match" or "matches, but the method doesn't exist".

Note however that this is already supported in elemental2.dom.Element, as well as many other other methods not found in dom.client.Element and subclasses. As Elemental2 is auto generated (from hand maintained externs) it will tend to be more up to date with what the rest of the browser world can support.

Does it make sense to just use elemental2 for your use cases where modern APIs are required?

@Greunlis
Copy link
Copy Markdown
Author

Thanks for pointing me to elemental2! Adding it just for this method alone seems like an overkill, but I might find other use cases in our codebase, I'll give it some more thought and either add a test or close this pull request as unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants