File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ Element? querySelector(String selectors) => document.querySelector(selectors);
53
53
54
54
bool isInstanceOfDomType (JSObject ? o, String domType) {
55
55
if (o == null ) return false ;
56
- final constructor = globalContext. getProperty ( domType.toJS) ;
56
+ final constructor = globalContext[ domType] ;
57
57
if (constructor == null ) return false ;
58
58
return o.instanceof (constructor as JSFunction ).toDart;
59
59
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ version: 0.1.5-wip
6
6
repository : https://github.com/dart-lang/web
7
7
8
8
environment :
9
- sdk : " >=3.2.0-75 .0.dev <4.0.0"
9
+ sdk : " >=3.2.0-157 .0.dev <4.0.0"
10
10
11
11
dev_dependencies :
12
12
args : ^2.4.0
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2
+ // for details. All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ @TestOn ('browser' )
6
+ library ;
7
+
8
+ import 'package:test/test.dart' ;
9
+ import 'package:web/helpers.dart' ;
10
+
11
+ void main () {
12
+ test ('isInstanceOfDomType' , () {
13
+ final div = document.createElement ('div' );
14
+
15
+ expect (isInstanceOfDomType (div, 'bob' ), false );
16
+ expect (isInstanceOfDomType (div, 'HTMLDivElement' ), true );
17
+ });
18
+ }
You can’t perform that action at this time.
0 commit comments