OLD | NEW |
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 // DO NOT EDIT | 5 // DO NOT EDIT |
6 // Auto-generated dart:html library. | 6 // Auto-generated dart:html library. |
7 | 7 |
8 #library("html"); | 8 #library("html"); |
9 | 9 |
10 #import('dart:dom', prefix:'dom'); | 10 #import('dart:dom', prefix:'dom'); |
(...skipping 14 matching lines...) Expand all Loading... |
25 #source('../../html/src/_Testing.dart'); | 25 #source('../../html/src/_Testing.dart'); |
26 #source('../../html/src/_DOMTypeBase.dart'); | 26 #source('../../html/src/_DOMTypeBase.dart'); |
27 #source('../../dom/src/_ListIterators.dart'); | 27 #source('../../dom/src/_ListIterators.dart'); |
28 #source('../../dom/src/_Lists.dart'); | 28 #source('../../dom/src/_Lists.dart'); |
29 | 29 |
30 _WindowImpl __window; | 30 _WindowImpl __window; |
31 _DocumentImpl __document; | 31 _DocumentImpl __document; |
32 | 32 |
33 void _initialize() { | 33 void _initialize() { |
34 __window = _wrap(dom.window); | 34 __window = _wrap(dom.window); |
35 __document = _wrap(dom.document.documentElement); | 35 __document = _wrap(dom.document); |
36 } | 36 } |
37 | 37 |
38 Window get window() { | 38 Window get window() { |
39 if (__window == null) { | 39 if (__window == null) { |
40 _initialize(); | 40 _initialize(); |
41 } | 41 } |
42 return __window; | 42 return __window; |
43 } | 43 } |
44 | 44 |
45 Document get document() { | 45 Document get document() { |
(...skipping 21 matching lines...) Expand all Loading... |
67 return raw is _DOMTypeBase ? raw._ptr : raw; | 67 return raw is _DOMTypeBase ? raw._ptr : raw; |
68 } | 68 } |
69 | 69 |
70 // Warning: does not attempt wrap event listeners. | 70 // Warning: does not attempt wrap event listeners. |
71 _wrap(raw) { | 71 _wrap(raw) { |
72 if (raw is! dom.DOMType) return raw; | 72 if (raw is! dom.DOMType) return raw; |
73 dom.DOMType domObject = raw; | 73 dom.DOMType domObject = raw; |
74 if (domObject.dartObjectLocalStorage != null) | 74 if (domObject.dartObjectLocalStorage != null) |
75 return domObject.dartObjectLocalStorage; | 75 return domObject.dartObjectLocalStorage; |
76 switch(domObject.typeName) { | 76 switch(domObject.typeName) { |
77 case 'HTMLDocument': | |
78 throw 'A document should never be wrapped directly. TODO(jacobr) XXX'; | |
79 case 'HTMLHtmlElement': | |
80 return new _DocumentImpl._wrap(domObject); | |
81 case 'HTMLElement': | 77 case 'HTMLElement': |
82 return new _UnknownElementImpl._wrap(domObject); | 78 return new _UnknownElementImpl._wrap(domObject); |
83 $WRAPCASES | 79 $WRAPCASES |
| 80 case 'HTMLDocument': |
| 81 return new _DocumentImpl._wrap(domObject); |
84 default: | 82 default: |
85 throw 'Unrecognized object $domObject. Name=${domObject.typeName}'; | 83 throw 'Unrecognized object $domObject. Name=${domObject.typeName}'; |
86 } | 84 } |
87 } | 85 } |
OLD | NEW |