Skip to content

Dynamically <script> elements fail if the calling script is not inline. #4584

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


What steps will reproduce the problem?

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&quot;&gt;&lt;/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&quot;&gt;&lt;/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>
    ...

What is the expected output? What do you see instead?

Using an external script should work.

What version of the product are you using? On what operating system?

Ubuntu 12.04. Dart Editor Bundle Version 0.1.0.201208061536, Build 10315

Please provide any additional information below.

There is an open StackOverflow question about this problem here: http://stackoverflow.com/questions/11911754/load-a-dart-script-dynamically-using-dart

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-duplicateClosed in favor of an existing report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions