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

Unified Diff: packages/analyzer/doc/support/dart.js

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 | « packages/analyzer/benchmark/errors_in_all_libraries.dart ('k') | packages/analyzer/doc/support/style.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/doc/support/dart.js
diff --git a/packages/analyzer/doc/support/dart.js b/packages/analyzer/doc/support/dart.js
new file mode 100644
index 0000000000000000000000000000000000000000..f8d686e1ab832e4534b442a34a86ecbaf44f17d6
--- /dev/null
+++ b/packages/analyzer/doc/support/dart.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2013, 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.
+
+(function() {
+// Bootstrap support for Dart scripts on the page as this script.
+if (navigator.userAgent.indexOf('(Dart)') === -1) {
+ // 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 (type="application/dart").
+ 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]);
+ }
+ }
+ }
+}
+})();
« no previous file with comments | « packages/analyzer/benchmark/errors_in_all_libraries.dart ('k') | packages/analyzer/doc/support/style.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698