JavaScript built and minified with dart2js does not handle SubmitEvent properly.

Dart VM version: 2.7.1
MacOS Catalina 10.15.3
Firefox Nightly 75.0a1

I was making a very simple web app, and while it had no errors when served using webdev serve, after using webdev build and serving the production files, I get the following error in the console.

: TypeError: Instance of 'bG': type 'bG' is not a subtype of type 'minified:k'

I’ve tried using Chrome and had no problems. And I booted up an Ubuntu machine I have with normal Firefox installed and had no problems there either.

This is the repository where I’m having the problem:

I realize this could just be a problem with Nightly, and I’ll try to make bug report on Bugzilla.

Author: Fantashit

2 thoughts on “JavaScript built and minified with dart2js does not handle SubmitEvent properly.

  1. FirefoxNightly dispatches the form submit event with SubmitEvent, that seems not to be handled in dart.
    added by

    the example code receives the parameter with Event type:
    and it looks like SubmitEvent isn’t treated as a subtype of Event.

    If I add SubmitEvent to the object passed to hunkHelpers.setOrUpdateInterceptorsByTag call, in generated code in
    the issue doesn’t happen.

    prettified code below:

                Event: W.k,
                SubmitEvent: W.k,  // <-- added here
                InputEvent: W.k,

    so, it sounds like, the inheritance isn’t handled properly for unknown interface.

  2. There is a hook for mapping unknown ‘native’ classes to existing ‘native’ classes.
    Put this in your html file ahead of the script tag that loads the dart app:

    if (typeof dartNativeDispatchHooksTransformer == "undefined") dartNativeDispatchHooksTransformer=[];
    function(hooks) {
      var getTag = hooks.getTag;
      var quickMap = {
          "SubmitEvent": "Event",
      function getTagFixed(o) {
        var tag = getTag(o);
        return quickMap[tag] || tag;
      hooks.getTag = getTagFixed;

    What it does is make a SubmitEvent appear to the Dart program as a plain Event.

    @srujzs We can change the dart:html library to do something similar automatically.

Comments are closed.