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

Unified Diff: client/dart.js

Issue 9226025: New dart.js bootstrap script for apps (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/dart.js
diff --git a/client/dart.js b/client/dart.js
new file mode 100644
index 0000000000000000000000000000000000000000..7ccf42b9e6609934521c87add98d9654751d9036
--- /dev/null
+++ b/client/dart.js
@@ -0,0 +1,27 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Bootstrap support for Dart scripts on the page as this script.
+
+if (!document.implementation.hasFeature('dart', '1.0')) {
+ window.addEventListener("DOMContentLoaded", function (e) {
+ // Fall back to compiled JS.
+ 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.js.
+ // TODO:
+ // - Support in-browser compilation.
+ // - Handle inline Dart scripts.
+ if (scripts[i].src && scripts[i].src != '') {
+ var script = document.createElement('script');
+ script.src = scripts[i].src + '.js';
+ var parent = scripts[i].parentNode;
+ parent.replaceChild(script, scripts[i]);
dgrove 2012/01/20 22:01:13 does this really work? (ie, the script starts exec
+ }
+ }
+ }
+ }, false);
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698