我正在尝试使用 dart 动态加载 dart 脚本。我正在使用这样的东西:
测试.html:
...
<script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
<script type="application/dart" src="test.dart"></script>
...
测试飞镖:
#import('dart:html');
main() {
var script = new ScriptElement();
script.type = 'application/dart';
script.src = 'helloworld.dart';
document.body.elements.add(script);
}
它不起作用。但是,如果我在 HTML 文件中内联相同的代码,它可以正常工作:
测试.html:
...
<script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
<script type="application/dart">
#import('dart:html');
main() {
var script = new ScriptElement();
script.type = 'application/dart';
script.src = 'helloworld.dart';
document.body.elements.add(script);
}
</script>
...
为什么会这样?