-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-ddc-discrepancyWhen dev and production compilations have different semanticsWhen dev and production compilations have different semanticsweb-js-interopIssues that impact all js interopIssues that impact all js interop
Description
Because we still support dart:html, implementation details escape and are visible in via JS interop (either in package:web or hand written interop that exposes browser APIs).
For example, this program:
import 'dart:html';
import 'dart:js_interop';
@JS('localStorage')
external JSObject myLocalStorage;
main() {
Object? x1 = window.localStorage;
print(x1 is Map);
Object? x2 = myLocalStorage;
print(x2 is Map);
}Prints true twice in DDC and dart2js.
If the dart:html code is tree-shaken, then dart2js changes behavior:
import 'dart:js_interop';
@JS('localStorage')
external JSObject myLocalStorage;
main() {
Object? x2 = myLocalStorage;
print(x2 is Map); // prints false in dart2js, but true in DDC.
}It's not clear if we want to change anything at this time, but this is also something we'd need to address in our process of deprecating and removing dart:html.
Note that, since dart2wasm doesn't support dart:html, it always prints false.
Metadata
Metadata
Assignees
Labels
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.dart2js-ddc-discrepancyWhen dev and production compilations have different semanticsWhen dev and production compilations have different semanticsweb-js-interopIssues that impact all js interopIssues that impact all js interop