This repository was archived by the owner on Jan 13, 2025. It is now read-only.
File tree 5 files changed +11
-17
lines changed
5 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import * as base from '@material/base/index.ts';
26
26
import * as checkbox from '@material/checkbox/index' ;
27
27
import * as chips from '@material/chips/index' ;
28
28
import * as dialog from '@material/dialog/index' ;
29
- import * as dom from '@material/dom/index' ;
29
+ import * as dom from '@material/dom/index.ts ' ;
30
30
import * as drawer from '@material/drawer/index' ;
31
31
import * as floatingLabel from '@material/floating-label/index' ;
32
32
import * as formField from '@material/form-field/index' ;
File renamed without changes.
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
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ class JsBundleFactory {
158
158
checkbox : getAbsolutePath ( '/packages/mdc-checkbox/index.js' ) ,
159
159
chips : getAbsolutePath ( '/packages/mdc-chips/index.js' ) ,
160
160
dialog : getAbsolutePath ( '/packages/mdc-dialog/index.js' ) ,
161
- dom : getAbsolutePath ( '/packages/mdc-dom/index.js ' ) ,
161
+ dom : getAbsolutePath ( '/packages/mdc-dom/index.ts ' ) ,
162
162
drawer : getAbsolutePath ( '/packages/mdc-drawer/index.js' ) ,
163
163
floatingLabel : getAbsolutePath ( '/packages/mdc-floating-label/index.js' ) ,
164
164
formField : getAbsolutePath ( '/packages/mdc-form-field/index.js' ) ,
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import {assert} from 'chai';
25
25
import bel from 'bel' ;
26
26
import td from 'testdouble' ;
27
27
28
- import { closest , matches } from '../../../packages/mdc-dom/ponyfill' ;
28
+ import { closest , matches } from '../../../packages/mdc-dom/ponyfill.ts ' ;
29
29
30
30
suite ( 'MDCDom - ponyfill' ) ;
31
31
You can’t perform that action at this time.
0 commit comments