I’m trying to load a dart script dynamically using dart. I’m using something like this:
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);
}
It doesn’t work. However, if I inline the same code in the HTML file, it works fine:
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>
...
Why is this happening?
This was a bug in Dart. Here is a link to the bug report.