This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree 2 files changed +9
-15
lines changed 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 21
21
* THE SOFTWARE.
22
22
*/
23
23
24
- import * as ponyfill from './ponyfill' ;
24
+ import * as ponyfill from './ponyfill.ts ' ;
25
25
26
26
export { ponyfill } ;
Original file line number Diff line number Diff line change 26
26
* This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
27
27
*/
28
28
29
- /**
30
- * @param {!Element } element
31
- * @param {string } selector
32
- * @return {?Element }
33
- */
34
- function closest ( element , selector ) {
29
+ interface MsElement extends Element {
30
+ msMatchesSelector ( selector : string ) : boolean ;
31
+ }
32
+
33
+ function closest ( element : Element , selector : string ) : Element | null {
35
34
if ( element . closest ) {
36
35
return element . closest ( selector ) ;
37
36
}
@@ -46,15 +45,10 @@ function closest(element, selector) {
46
45
return null ;
47
46
}
48
47
49
- /**
50
- * @param {!Element } element
51
- * @param {string } selector
52
- * @return {boolean }
53
- */
54
- function matches ( element , selector ) {
48
+ function matches ( element : Element , selector : string ) : boolean {
55
49
const nativeMatches = element . matches
56
- || element . webkitMatchesSelector
57
- || element . msMatchesSelector ;
50
+ || element . webkitMatchesSelector
51
+ || ( element as MsElement ) . msMatchesSelector ;
58
52
return nativeMatches . call ( element , selector ) ;
59
53
}
60
54
You can’t perform that action at this time.
0 commit comments