[英]dart2js's output causes “null is not an object”
After running 跑步后
private/dart/dart-sdk/bin/dart2js -m -o public/js/script.js private/dart/script.dart
The resulting javascript returns 结果javascript返回
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. 无论我使用script.js还是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 相关的haml是
.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. 我认为它应该按原样工作,尽管事实并非如此。
Figured it out. 弄清楚了。
I included the compiled javascript file inside the tag of the html page. 我将已编译的javascript文件包括在html页面的标签内。 Moving it to the very bottom of the body fixed everything. 将其移动到身体的最底部可以固定所有内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.