Chromium Code Reviews| 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. | |
| 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 // Remap foo.dart to foo.js. | |
| 15 // TODO: | |
| 16 // - Support in-browser compilation. | |
| 17 // - Handle inline Dart scripts. | |
| 18 if (scripts[i].src && scripts[i].src != '') { | |
| 19 var script = document.createElement('script'); | |
| 20 script.src = scripts[i].src + '.js'; | |
| 21 var parent = scripts[i].parentNode; | |
| 22 parent.replaceChild(script, scripts[i]); | |
|
dgrove
2012/01/20 22:01:13
does this really work? (ie, the script starts exec
| |
| 23 } | |
| 24 } | |
| 25 } | |
| 26 }, false); | |
| 27 } | |
| OLD | NEW |