OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 // Bootstrap support for Dart scripts on the page as this script. | |
6 | |
7 if (!document.implementation.hasFeature('dart', '1.0')) { | |
8 window.addEventListener("DOMContentLoaded", function (e) { | |
9 // Fall back to compiled JS. | |
danrubel
2012/01/20 21:20:36
Do we need a "is Dart available in this browser" c
vsm
2012/01/20 21:55:27
Line 7 is that check. Note, we will probably chan
| |
10 var scripts = document.getElementsByTagName("script"); | |
11 var length = scripts.length; | |
12 for (var i = 0; i < length; ++i) { | |
13 if (scripts[i].type == "application/dart") { | |
14 var script = document.createElement('script'); | |
15 // Remap foo.dart to foo.js. | |
16 // TODO: | |
17 // - Support in-browser compilation. | |
18 // - Handle inline Dart scripts. | |
19 if (scripts[i].src && scripts[i].src != '') { | |
20 script.src = scripts[i].src + '.js'; | |
21 document.body.appendChild(script); | |
dgrove
2012/01/20 20:57:03
won't this break scripts that want to look at thei
vsm
2012/01/20 21:55:27
Modified to replace the original script.
On 2012/
| |
22 } | |
23 } | |
24 } | |
25 }, false); | |
26 } | |
OLD | NEW |