我正在尝试使用Dart动态加载Dart脚本。我正在使用类似于以下内容的代码:
test.html:
...
<script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
<script type="application/dart" src="test.dart"></script>
...
test.dart:
#import('dart:html');
main() {
var script = new ScriptElement();
script.type = 'application/dart';
script.src = 'helloworld.dart';
document.body.elements.add(script);
}
它不起作用。但是,如果我将相同的代码内联到HTML文件中,它就可以正常工作:
test.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>
...
为什么会发生这种情况?