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 $!GENERATED_DART_FILES | 10 $!GENERATED_DART_FILES |
11 | 11 |
12 #source('../dom/src/EventListener.dart'); | 12 #source('../dom/src/EventListener.dart'); |
13 #source('../dom/src/KeyLocation.dart'); | 13 #source('../dom/src/KeyLocation.dart'); |
14 #source('../dom/src/KeyName.dart'); | 14 #source('../dom/src/KeyName.dart'); |
15 #source('../dom/src/ReadyState.dart'); | 15 #source('../dom/src/ReadyState.dart'); |
16 #source('../dom/src/TimeoutHandler.dart'); | 16 #source('../dom/src/TimeoutHandler.dart'); |
17 #source('../dom/src/_Collections.dart'); | 17 #source('../dom/src/_Collections.dart'); |
18 #source('../html/src/Measurement.dart'); | |
19 #source('../html/src/shared_FactoryProviders.dart'); | |
18 #source('../html/src/frog_FactoryProviders.dart'); | 20 #source('../html/src/frog_FactoryProviders.dart'); |
21 #source('../html/src/_Testing.dart'); | |
19 #source('../html/src/Device.dart'); | 22 #source('../html/src/Device.dart'); |
20 #source('../dom/src/_ListIterators.dart'); | 23 #source('../dom/src/_ListIterators.dart'); |
21 #source('../dom/src/_Lists.dart'); | 24 #source('../dom/src/_Lists.dart'); |
22 | 25 |
23 // TODO(sra): What 'window' do we get in a worker? Perhaps this | 26 _WindowImpl _cachedWindow; |
24 // should return the interface type. | 27 _DocumentImpl _cachedDocument; |
nweiz
2012/03/01 21:18:03
These should probably have the same name as they d
| |
25 Window get window() native "return window;"; | |
26 _WindowJs get _window() native "return window;"; | |
27 | 28 |
28 Document get document() native "return window.document.documentElement;"; | 29 void _init() { |
29 _DocumentJs get _document() native "return window.document.documentElement;"; | 30 _cachedDocument = _document; |
31 _cachedWindow = _window; | |
32 // Feature detect that dart:dom and dart:html are not both loaded by | |
33 // checking for the presence of a bug that manifests itself when both | |
34 // libraries are loaded. | |
35 // TODO(jacobr): remove this code once b/1911 is fixed and the frog compiler | |
36 // is changed to generate compile time errors if two libraries that define | |
37 // the same native types in conflicting ways are imported. | |
38 var element = new Element.tag('body'); | |
39 element.innerHTML = 'f'; | |
40 if (element.text == '') { | |
41 _cachedWindow.console.error( | |
42 'Cannot import dart:html and dart:dom within the same application.'); | |
43 throw new UnsupportedOperationException( | |
44 'Cannot import dart:html and dart:dom within the same application.'); | |
45 } | |
46 } | |
47 | |
48 Window get window() { | |
49 if (_cachedWindow == null) { | |
50 _init(); | |
51 } | |
52 return _cachedWindow; | |
53 } | |
54 | |
55 _WindowImpl get _window() native "return window;"; | |
56 | |
57 Document get document() { | |
58 if (_cachedDocument == null) { | |
59 _init(); | |
60 } | |
61 return _cachedDocument; | |
62 } | |
63 | |
64 _DocumentImpl get _document() native "return window.document.documentElement;"; | |
OLD | NEW |