-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes queryAssignedNodes when querying for nodes on browsers that do … #1092
Conversation
…have Element.matches Fixes #1088.
src/lib/decorators.ts
Outdated
@@ -465,9 +465,10 @@ export function queryAssignedNodes( | |||
if (nodes && selector) { | |||
nodes = nodes.filter( | |||
(node) => node.nodeType === Node.ELEMENT_NODE && | |||
(node as Element).matches ? | |||
// tslint:disable-next-line:no-any testing existence on older browsers | |||
((node as any).matches ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the DOM types include .matches
you shouldn't need the as any
cast. Did the old code not type-check?
(node as Element).matches(selector) : | ||
legacyMatches.call(node as Element, selector)); | ||
// tslint:disable-next-line:no-any testing existence on older browsers | ||
((node as any).matches ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still curious about this cast here. Why is it necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript complains that the check is unnecessary becausematches
always exists. The previous code probably didn't analyze path.
…have Element.matches
Fixes #1088.