Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: pkg/browser/lib/dart.js

Issue 23201005: Revert revision 26149. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | samples/third_party/dromaeo/generate_dart2js_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/browser/lib/dart.js
===================================================================
--- pkg/browser/lib/dart.js (revision 26171)
+++ pkg/browser/lib/dart.js (working copy)
@@ -11,27 +11,28 @@
// TODO:
// - Support in-browser compilation.
// - Handle inline Dart scripts.
-
- // Fall back to compiled JS. Run through all the scripts and
- // replace them if they have a type that indicate that they source
- // in Dart code.
- //
- // <script type="application/dart" src="..."></script>
- //
- var scripts = document.getElementsByTagName("script");
- var length = scripts.length;
- for (var i = 0; i < length; ++i) {
- if (scripts[i].type == "application/dart") {
- // Remap foo.dart to foo.dart.js.
- if (scripts[i].src && scripts[i].src != '') {
- var script = document.createElement('script');
- script.src = scripts[i].src.replace(/\.dart(?=\?|$)/, '.dart.js');
- var parent = scripts[i].parentNode;
- // TODO(vsm): Find a solution for issue 8455 that works with more
- // than one script.
- document.currentScript = script;
- parent.replaceChild(script, scripts[i]);
+ window.addEventListener("DOMContentLoaded", function (e) {
+ // Fall back to compiled JS. Run through all the scripts and
+ // replace them if they have a type that indicate that they source
+ // in Dart code.
+ //
+ // <script type="application/dart" src="..."></script>
+ //
+ var scripts = document.getElementsByTagName("script");
+ var length = scripts.length;
+ for (var i = 0; i < length; ++i) {
+ if (scripts[i].type == "application/dart") {
+ // Remap foo.dart to foo.dart.js.
+ if (scripts[i].src && scripts[i].src != '') {
+ var script = document.createElement('script');
+ script.src = scripts[i].src.replace(/\.dart(?=\?|$)/, '.dart.js');
+ var parent = scripts[i].parentNode;
+ // TODO(vsm): Find a solution for issue 8455 that works with more
+ // than one script.
+ document.currentScript = script;
+ parent.replaceChild(script, scripts[i]);
+ }
}
}
- }
+ }, false);
}
« no previous file with comments | « no previous file | samples/third_party/dromaeo/generate_dart2js_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698