Created
August 9, 2020 11:13
-
-
Save PatrickJS/dc5ba3c9391c8c2ac7b54a14347cb14f to your computer and use it in GitHub Desktop.
angular/packages/elements/src/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let matches = null; | |
export function matchesSelector(element: Element, selector: string): boolean { | |
if (!matches) { | |
const elProto = Element.prototype as any; | |
matches = elProto.matches || elProto.matchesSelector || elProto.mozMatchesSelector || | |
elProto.msMatchesSelector || elProto.oMatchesSelector || elProto.webkitMatchesSelector; | |
} | |
return matches.call(element, selector); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment