0

After running

private/dart/dart-sdk/bin/dart2js -m -o public/js/script.js private/dart/script.dart

The resulting javascript returns

TypeError: 'null' is not an object (evaluating 'J.RE(a).gVs')

However, the error while not minified is

TypeError: 'null' is not an object (evaluating 'J.getInterceptor$x(receiver).get$onBlur')

Which might be more meaningfull.

It does this whether I use script.js, or script.compiled.js.

The dart code is

import 'dart:html';
import 'dart:core';

void main() {
   querySelector("#authorInput").onBlur.listen(updateSurname);
}
void updateSurname(Event e){
   String author = (e.target as InputElement).value;
   String surname = author.split(' ').last;
   querySelector("#surnameInput").text = surname;
}

The relevant haml is

  .form-group
     %label(for="authorInput") Author
     %input.form-control#authorInput(type="text" name="author" placeholder="Enter author")
  .form-group
     %label(for="surnameInput") Surname
     %input.form-control#surnameInput(type="text" name="surname" placeholder="Enter surname")

I believe it should work as is, though that's clearly not the case.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Cereal
  • 3,699
  • 2
  • 23
  • 36

1 Answers1

1

Figured it out.

I included the compiled javascript file inside the tag of the html page. Moving it to the very bottom of the body fixed everything.

Cereal
  • 3,699
  • 2
  • 23
  • 36