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

Side by Side Diff: client/dart.js

Issue 9310059: Nuke DOMImplementation.hasFeature test for Dart support. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Bootstrap support for Dart scripts on the page as this script. 5 // Bootstrap support for Dart scripts on the page as this script.
6 6
7 // TODO: remove hasFeature clause once fully migrated to webkitStartDart.
8 if (navigator.webkitStartDart) { 7 if (navigator.webkitStartDart) {
9 navigator.webkitStartDart(); 8 navigator.webkitStartDart();
10 } else if (!document.implementation.hasFeature('dart', '1.0')) { 9 } else {
11 window.addEventListener("DOMContentLoaded", function (e) { 10 window.addEventListener("DOMContentLoaded", function (e) {
12 // Fall back to compiled JS. 11 // Fall back to compiled JS.
13 var scripts = document.getElementsByTagName("script"); 12 var scripts = document.getElementsByTagName("script");
14 var length = scripts.length; 13 var length = scripts.length;
15 for (var i = 0; i < length; ++i) { 14 for (var i = 0; i < length; ++i) {
16 if (scripts[i].type == "application/dart") { 15 if (scripts[i].type == "application/dart") {
17 // Remap foo.dart to foo.js. 16 // Remap foo.dart to foo.js.
18 // TODO: 17 // TODO:
19 // - Support in-browser compilation. 18 // - Support in-browser compilation.
20 // - Handle inline Dart scripts. 19 // - Handle inline Dart scripts.
21 if (scripts[i].src && scripts[i].src != '') { 20 if (scripts[i].src && scripts[i].src != '') {
22 var script = document.createElement('script'); 21 var script = document.createElement('script');
23 script.src = scripts[i].src + '.js'; 22 script.src = scripts[i].src + '.js';
24 var parent = scripts[i].parentNode; 23 var parent = scripts[i].parentNode;
25 parent.replaceChild(script, scripts[i]); 24 parent.replaceChild(script, scripts[i]);
26 } 25 }
27 } 26 }
28 } 27 }
29 }, false); 28 }, false);
30 } 29 }
OLDNEW
« 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