Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DartBot opened this issue Aug 18, 2012 · 3 comments
Closed
Labels
closed-duplicate Closed in favor of an existing report

Comments

@DartBot
Copy link

DartBot commented Aug 18, 2012

This issue was originally filed by ceronman...@gmail.com


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

@larsbak
Copy link

larsbak commented Aug 21, 2012

Set owner to antonm@google.com.
Added Area-Dartium label.

@larsbak
Copy link

larsbak commented Aug 21, 2012

Added Triaged label.

@DartBot
Copy link
Author

DartBot commented Aug 22, 2012

This comment was originally written by antonm@google.com


This is by design as of now due to various technical reasons.

Recommended way is to spawn DOM isolate (see top-level spawnDomFunction).

Merging into a bug which I marked won't fix. If suggested workaround doesn't work for you, let's discuss it there.


Added Duplicate label.
Marked as being merged into #4636.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

2 participants