| OLD | NEW |
| 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 function ie$typeNameOf() { | 450 function ie$typeNameOf() { |
| 451 var name = constructorNameWithFallback(this); | 451 var name = constructorNameWithFallback(this); |
| 452 if (name == 'Window') return 'DOMWindow'; | 452 if (name == 'Window') return 'DOMWindow'; |
| 453 // IE calls both HTML and XML documents 'Document', so we check for the | 453 // IE calls both HTML and XML documents 'Document', so we check for the |
| 454 // xmlVersion property, which is the empty string on HTML documents. | 454 // xmlVersion property, which is the empty string on HTML documents. |
| 455 if (name == 'Document' && this.xmlVersion) return 'Document'; | 455 if (name == 'Document' && this.xmlVersion) return 'Document'; |
| 456 if (name == 'Document') return 'HTMLDocument'; | 456 if (name == 'Document') return 'HTMLDocument'; |
| 457 if (name == 'HTMLTableDataCellElement') return 'HTMLTableCellElement'; | 457 if (name == 'HTMLTableDataCellElement') return 'HTMLTableCellElement'; |
| 458 if (name == 'HTMLTableHeaderCellElement') return 'HTMLTableCellElement'; | 458 if (name == 'HTMLTableHeaderCellElement') return 'HTMLTableCellElement'; |
| 459 if (name == 'MSStyleCSSProperties') return 'CSSStyleDeclaration'; | 459 if (name == 'MSStyleCSSProperties') return 'CSSStyleDeclaration'; |
| 460 if (name == 'CanvasPixelArray') return 'Uint8ClampedArray'; |
| 461 if (name == 'HTMLPhraseElement') return 'HTMLElement'; |
| 460 return name; | 462 return name; |
| 461 } | 463 } |
| 462 | 464 |
| 463 // If we're not in the browser, we're almost certainly running on v8. | 465 // If we're not in the browser, we're almost certainly running on v8. |
| 464 if (typeof(navigator) != 'object') return chrome$typeNameOf; | 466 if (typeof(navigator) != 'object') return chrome$typeNameOf; |
| 465 | 467 |
| 466 var userAgent = navigator.userAgent; | 468 var userAgent = navigator.userAgent; |
| 467 if (/Chrome|DumpRenderTree/.test(userAgent)) return chrome$typeNameOf; | 469 if (/Chrome|DumpRenderTree/.test(userAgent)) return chrome$typeNameOf; |
| 468 if (/Firefox/.test(userAgent)) return firefox$typeNameOf; | 470 if (/Firefox/.test(userAgent)) return firefox$typeNameOf; |
| 469 if (/MSIE/.test(userAgent)) return ie$typeNameOf; | 471 if (/MSIE/.test(userAgent)) return ie$typeNameOf; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 return bound; | 632 return bound; |
| 631 } else { | 633 } else { |
| 632 var bound = function() { | 634 var bound = function() { |
| 633 return func.apply(thisObj, arguments); | 635 return func.apply(thisObj, arguments); |
| 634 }; | 636 }; |
| 635 bound.$length = funcLength; | 637 bound.$length = funcLength; |
| 636 return bound; | 638 return bound; |
| 637 } | 639 } |
| 638 }; | 640 }; |
| 639 """; | 641 """; |
| OLD | NEW |