Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: ${{ matrix.sdk }}
flavor: ${{ matrix.flavor }}
- id: install
name: Install dependencies
run: dart pub get
Expand All @@ -37,9 +38,10 @@ jobs:
run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

# Run tests on a matrix consisting of two dimensions:
# Run tests on a matrix consisting of three dimensions:
# 1. OS: ubuntu-latest, (macos-latest, windows-latest)
# 2. release channel: dev
# 2. release channel: main, dev
# 3. flavor: raw
test:
needs: analyze
runs-on: ${{ matrix.os }}
Expand All @@ -55,6 +57,7 @@ jobs:
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: ${{ matrix.sdk }}
flavor: ${{ matrix.flavor }}
- id: install
name: Install dependencies
run: dart pub get
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.2.2-beta

- Updates SDK version minimum to 3.2.0-194.0.dev.
- Removes `isInstanceOfDomType` as `dart:js_interop` now exposes
`instanceOfString`.

## 0.2.1-beta

- `helpers.dart`
Expand Down
7 changes: 0 additions & 7 deletions lib/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,3 @@ external JSFunction get _audioConstructor;
HTMLAudioElement createAudioElement() => _audioConstructor.callAsConstructor();

Element? querySelector(String selectors) => document.querySelector(selectors);

bool isInstanceOfDomType(JSObject? o, String domType) {
if (o == null) return false;
final constructor = globalContext[domType];
if (constructor == null) return false;
return o.instanceof(constructor as JSFunction).toDart;
}
2 changes: 1 addition & 1 deletion lib/src/helpers/events/providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ String _determineTransitionEventType(EventTarget e) {
}

String _determineVisibilityChangeEventType(EventTarget e) {
if (e.typeofEquals('undefined'.toJS).toDart) {
if (e.typeofEquals('undefined')) {
return 'visibilitychange';
} else if (e.hasProperty('mozHidden'.toJS).toDart) {
return 'mozvisibilitychange';
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: web
description: >-
Lightweight DOM and JS bindings built around JS static interop.
version: 0.2.1-beta
version: 0.2.2-beta

repository: https://github.com/dart-lang/web

environment:
sdk: ">=3.2.0-157.0.dev <4.0.0"
sdk: ">=3.2.0-194.0.dev <4.0.0"

dev_dependencies:
args: ^2.4.0
Expand Down
8 changes: 5 additions & 3 deletions test/helpers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
@TestOn('browser')
library;

import 'dart:js_interop';

import 'package:test/test.dart';
import 'package:web/helpers.dart';

void main() {
test('isInstanceOfDomType', () {
test('instanceOfString works with package:web types', () {
final div = document.createElement('div');

expect(isInstanceOfDomType(div, 'bob'), false);
expect(isInstanceOfDomType(div, 'HTMLDivElement'), true);
expect(div.instanceOfString('bob'), false);
expect(div.instanceOfString('HTMLDivElement'), true);
});
}