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 $!GENERATED_DART_FILES | |
11 | |
12 #source('../../dom/src/EventListener.dart'); | |
13 #source('../../dom/src/KeyLocation.dart'); | |
14 #source('../../dom/src/KeyName.dart'); | |
15 #source('../../dom/src/ReadyState.dart'); | |
16 #source('../../dom/src/TimeoutHandler.dart'); | |
17 #source('../../dom/src/_Collections.dart'); | |
18 #source('../../dom/src/_XMLHttpRequestUtils.dart'); | |
19 #source('../../html/src/Measurement.dart'); | |
20 #source('../../html/src/shared_FactoryProviders.dart'); | |
21 #source('../../html/src/frog_FactoryProviders.dart'); | |
22 #source('../../html/src/_Testing.dart'); | |
23 #source('../../html/src/Device.dart'); | |
24 #source('../../dom/src/_ListIterators.dart'); | |
25 #source('../../dom/src/_Lists.dart'); | |
26 | |
27 _WindowImpl _cachedWindow; | |
28 _DocumentImpl _cachedDocument; | |
29 | |
30 void _init() { | |
31 _cachedDocument = _document; | |
32 _cachedWindow = _window; | |
33 // Feature detect that dart:dom and dart:html are not both loaded by | |
34 // checking for the presence of a bug that manifests itself when both | |
35 // libraries are loaded. | |
36 // TODO(jacobr): remove this code once b/1911 is fixed and the frog compiler | |
37 // is changed to generate compile time errors if two libraries that define | |
38 // the same native types in conflicting ways are imported. | |
39 var element = new Element.tag('body'); | |
40 element.innerHTML = 'f'; | |
41 if (element.text == '') { | |
42 _cachedWindow.console.error( | |
43 'Cannot import dart:html and dart:dom within the same application.'); | |
44 throw new UnsupportedOperationException( | |
45 'Cannot import dart:html and dart:dom within the same application.'); | |
46 } | |
47 } | |
48 | |
49 Window get window() { | |
50 if (_cachedWindow == null) { | |
51 _init(); | |
52 } | |
53 return _cachedWindow; | |
54 } | |
55 | |
56 _WindowImpl get _window() native "return window;"; | |
57 | |
58 Document get document() { | |
59 if (_cachedDocument == null) { | |
60 _init(); | |
61 } | |
62 return _cachedDocument; | |
63 } | |
64 | |
65 _DocumentImpl get _document() native "return window.document.documentElement;"; | |
66 | |
67 // Workaround for tags like <cite> that lack their own Element subclass -- | |
68 // Dart issue 1990. | |
69 class _HTMLElementImpl extends _ElementImpl native "*HTMLElement" { | |
70 } | |
OLD | NEW |