Index: pkg/browser/lib/dart.js |
diff --git a/pkg/browser/lib/dart.js b/pkg/browser/lib/dart.js |
index 48cd8ad63b5aedb0a3f4a5a5cd611f1fa5a62c14..e14bfbbe568c94ccfc2f3c070df5d74d9f90c761 100644 |
--- a/pkg/browser/lib/dart.js |
+++ b/pkg/browser/lib/dart.js |
@@ -11,28 +11,27 @@ if (navigator.webkitStartDart) { |
// TODO: |
// - Support in-browser compilation. |
// - Handle inline Dart scripts. |
- 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]); |
- } |
+ |
+ // 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); |
+ } |
} |