OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // DO NOT EDIT |
| 6 // Auto-generated dart:html library. |
| 7 |
| 8 #library("html"); |
| 9 |
| 10 #import('dart:dom', prefix:'dom'); |
| 11 |
| 12 $!GENERATED_DART_FILES |
| 13 |
| 14 #source('../dom/src/EventListener.dart'); |
| 15 #source('../dom/src/KeyLocation.dart'); |
| 16 #source('../dom/src/KeyName.dart'); |
| 17 #source('../dom/src/ReadyState.dart'); |
| 18 #source('../dom/src/TimeoutHandler.dart'); |
| 19 #source('../dom/src/_Collections.dart'); |
| 20 #source('../html/src/shared_FactoryProviders.dart'); |
| 21 #source('../html/src/dartium_FactoryProviders.dart'); |
| 22 #source('../html/src/Measurement.dart'); |
| 23 #source('../html/src/Device.dart'); |
| 24 #source('../html/src/_Testing.dart'); |
| 25 #source('../html/src/_DOMTypeBase.dart'); |
| 26 #source('../dom/src/_ListIterators.dart'); |
| 27 #source('../dom/src/_Lists.dart'); |
| 28 |
| 29 _WindowImpl __window; |
| 30 _DocumentImpl __document; |
| 31 |
| 32 void _initialize() { |
| 33 __window = _wrap(dom.window); |
| 34 __document = _wrap(dom.document.documentElement); |
| 35 } |
| 36 |
| 37 Window get window() { |
| 38 if (__window == null) { |
| 39 _initialize(); |
| 40 } |
| 41 return __window; |
| 42 } |
| 43 |
| 44 Document get document() { |
| 45 if (__document == null) { |
| 46 _initialize(); |
| 47 } |
| 48 return __document; |
| 49 } |
| 50 |
| 51 _WindowImpl get _window() { |
| 52 if (__window == null) { |
| 53 _initialize(); |
| 54 } |
| 55 return __window; |
| 56 } |
| 57 |
| 58 _DocumentImpl get _document() { |
| 59 if (__document == null) { |
| 60 _initialize(); |
| 61 } |
| 62 return __document; |
| 63 } |
| 64 |
| 65 _unwrap(raw) { |
| 66 return raw is _DOMTypeBase ? raw._ptr : raw; |
| 67 } |
| 68 |
| 69 // Warning: does not attempt wrap event listeners. |
| 70 _wrap(raw) { |
| 71 if (raw is! dom.DOMType) return raw; |
| 72 dom.DOMType domObject = raw; |
| 73 if (domObject.dartObjectLocalStorage != null) |
| 74 return domObject.dartObjectLocalStorage; |
| 75 switch(domObject.typeName) { |
| 76 case 'HTMLDocument': |
| 77 throw 'A document should never be wrapped directly. TODO(jacobr) XXX'; |
| 78 case 'HTMLHtmlElement': |
| 79 return new _DocumentImpl._wrap(domObject); |
| 80 $WRAPCASES |
| 81 default: |
| 82 throw 'Unrecognized object $domObject. Name=${domObject.typeName}'; |
| 83 } |
| 84 } |
OLD | NEW |