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

Side by Side Diff: frog/corejs.dart

Issue 9478021: Add some sweet XML classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | « client/tests/client/html/util.dart ('k') | frog/minfrog » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** 5 /**
6 * Generates JS helpers for dart:core. This used to be in a file "core.js". 6 * Generates JS helpers for dart:core. This used to be in a file "core.js".
7 * Having them in Dart code means we can easily control which are generated. 7 * Having them in Dart code means we can easily control which are generated.
8 */ 8 */
9 // TODO(jmesserly): one idea to make this cleaner: put these as private "native" 9 // TODO(jmesserly): one idea to make this cleaner: put these as private "native"
10 // methods somewhere in a library that we import. This would be rather elegant 10 // methods somewhere in a library that we import. This would be rather elegant
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // we have to fall through to the toString() based implementation 401 // we have to fall through to the toString() based implementation
402 // below in that case. 402 // below in that case.
403 if (name && typeof(name) == 'string' && name != 'Object') return name; 403 if (name && typeof(name) == 'string' && name != 'Object') return name;
404 } 404 }
405 var string = Object.prototype.toString.call(this); 405 var string = Object.prototype.toString.call(this);
406 var name = string.substring(8, string.length - 1); 406 var name = string.substring(8, string.length - 1);
407 if (name == 'Window') { 407 if (name == 'Window') {
408 name = 'DOMWindow'; 408 name = 'DOMWindow';
409 } else if (name == 'Document') { 409 } else if (name == 'Document') {
410 name = 'HTMLDocument'; 410 name = 'HTMLDocument';
411 } else if (name == 'XMLDocument') {
412 name = 'Document';
411 } 413 }
412 return name; 414 return name;
413 });"""; 415 });""";
414 416
415 /** Snippet for `$inherits`. */ 417 /** Snippet for `$inherits`. */
416 final String _INHERITS_FUNCTION = @""" 418 final String _INHERITS_FUNCTION = @"""
417 /** Implements extends for Dart classes on JavaScript prototypes. */ 419 /** Implements extends for Dart classes on JavaScript prototypes. */
418 function $inherits(child, parent) { 420 function $inherits(child, parent) {
419 if (child.prototype.__proto__) { 421 if (child.prototype.__proto__) {
420 child.prototype.__proto__ = parent.prototype; 422 child.prototype.__proto__ = parent.prototype;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 bound.$length = Math.max(0, funcLength - (argsLength - 1)); 557 bound.$length = Math.max(0, funcLength - (argsLength - 1));
556 return bound; 558 return bound;
557 } else { 559 } else {
558 var bound = function() { 560 var bound = function() {
559 return func.apply(thisObj, arguments); 561 return func.apply(thisObj, arguments);
560 }; 562 };
561 bound.$length = funcLength; 563 bound.$length = funcLength;
562 return bound; 564 return bound;
563 } 565 }
564 };"""; 566 };""";
OLDNEW
« no previous file with comments | « client/tests/client/html/util.dart ('k') | frog/minfrog » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698