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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 @DocsEditable() | 7 @DocsEditable() |
8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node | 8 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME extends Node |
9 { | 9 { |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 @deprecated | 61 @deprecated |
62 bool get supportsRegister => supportsRegisterElement; | 62 bool get supportsRegister => supportsRegisterElement; |
63 | 63 |
64 @DomName('Document.createElement') | 64 @DomName('Document.createElement') |
65 Element createElement(String tagName, [String typeExtension]) { | 65 Element createElement(String tagName, [String typeExtension]) { |
66 $if DART2JS | 66 $if DART2JS |
67 return (typeExtension == null) | 67 return (typeExtension == null) |
68 ? _createElement_2(tagName) | 68 ? _createElement_2(tagName) |
69 : _createElement(tagName, typeExtension); | 69 : _createElement(tagName, typeExtension); |
70 $else | 70 $else |
71 var newElement = (typeExtension == null) ? | 71 return (typeExtension == null) ? |
72 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this),
tagName) : | 72 _blink.Blink_Utils.createElement(tagName) : |
73 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this),
tagName, typeExtension); | 73 // XXX FIX THIS CASE |
74 | 74 _blink.BlinkDocument.instance.createElement_Callback_2_(this, tagName, typ
eExtension); |
75 var wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart clas
s. | |
76 if (wrapped != null) { | |
77 wrapped.blink_jsObject = newElement; | |
78 } else { | |
79 wrapped = wrap_jso(newElement); | |
80 if (wrapped == null) { | |
81 wrapped = wrap_jso_custom_element(newElement); | |
82 } else { | |
83 js.setDartHtmlWrapperFor(wrapped.blink_jsObject, wrapped); | |
84 } | |
85 } | |
86 | |
87 return wrapped; | |
88 $endif | 75 $endif |
89 } | 76 } |
90 | 77 |
91 $if DART2JS | 78 $if DART2JS |
92 // The two-argument version of this is automatically generated, but we need to | 79 // The two-argument version of this is automatically generated, but we need to |
93 // omit the typeExtension if it's null on Firefox or we get an is="null" attri
bute. | 80 // omit the typeExtension if it's null on Firefox or we get an is="null" attri
bute. |
94 @DomName('Document.createElement') | 81 @DomName('Document.createElement') |
95 _createElement_2(String tagName) => | 82 _createElement_2(String tagName) => |
96 JS('Element', '#.createElement(#)', this, tagName); | 83 JS('Element', '#.createElement(#)', this, tagName); |
97 | 84 |
98 // The three-argument version of this is automatically generated, but we need
to | 85 // The three-argument version of this is automatically generated, but we need
to |
99 // omit the typeExtension if it's null on Firefox or we get an is="null" attri
bute. | 86 // omit the typeExtension if it's null on Firefox or we get an is="null" attri
bute. |
100 @DomName('Document.createElementNS') | 87 @DomName('Document.createElementNS') |
101 _createElementNS_2(String namespaceURI, String qualifiedName) => | 88 _createElementNS_2(String namespaceURI, String qualifiedName) => |
102 JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName
); | 89 JS('Element', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName
); |
103 | 90 |
104 $endif | 91 $endif |
105 @DomName('Document.createElementNS') | 92 @DomName('Document.createElementNS') |
106 @DocsEditable() | 93 @DocsEditable() |
107 Element createElementNS(String namespaceURI, String qualifiedName, [String typ
eExtension]) { | 94 Element createElementNS(String namespaceURI, String qualifiedName, [String typ
eExtension]) { |
108 $if DART2JS | 95 $if DART2JS |
109 return (typeExtension == null) | 96 return (typeExtension == null) |
110 ? _createElementNS_2(namespaceURI, qualifiedName) | 97 ? _createElementNS_2(namespaceURI, qualifiedName) |
111 : _createElementNS(namespaceURI, qualifiedName, typeExtension); | 98 : _createElementNS(namespaceURI, qualifiedName, typeExtension); |
112 $else | 99 $else |
113 var newElement = (typeExtension == null) ? | 100 return (typeExtension == null) ? |
114 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this)
, namespaceURI, qualifiedName) : | 101 _blink.BlinkDocument.instance.createElementNS_Callback_2_(this, namespaceU
RI, qualifiedName) : |
115 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this)
, namespaceURI, qualifiedName, typeExtension); | 102 _blink.BlinkDocument.instance.createElementNS_Callback_3_(this, namespaceU
RI, qualifiedName, typeExtension); |
116 | |
117 var wrapped; | |
118 | |
119 wrapped = js.getDartHtmlWrapperFor(newElement); // Here's our Dart class. | |
120 if (wrapped != null) { | |
121 wrapped.blink_jsObject = newElement; | |
122 } else { | |
123 wrapped = wrap_jso(newElement); | |
124 if (wrapped == null) { | |
125 wrapped = wrap_jso_custom_element(newElement); | |
126 } else { | |
127 js.setDartHtmlWrapperFor(wrapped.blink_jsObject, wrapped); // Here's ou
r Dart class. | |
128 } | |
129 } | |
130 | |
131 return wrapped; | |
132 $endif | 103 $endif |
133 } | 104 } |
134 | 105 |
135 $if DART2JS | 106 $if DART2JS |
136 @DomName('Document.createNodeIterator') | 107 @DomName('Document.createNodeIterator') |
137 NodeIterator _createNodeIterator(Node root, | 108 NodeIterator _createNodeIterator(Node root, |
138 [int whatToShow, NodeFilter filter]) | 109 [int whatToShow, NodeFilter filter]) |
139 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', | 110 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', |
140 this, root, whatToShow, filter); | 111 this, root, whatToShow, filter); |
141 | 112 |
142 @DomName('Document.createTreeWalker') | 113 @DomName('Document.createTreeWalker') |
143 TreeWalker _createTreeWalker(Node root, | 114 TreeWalker _createTreeWalker(Node root, |
144 [int whatToShow, NodeFilter filter]) | 115 [int whatToShow, NodeFilter filter]) |
145 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', | 116 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', |
146 this, root, whatToShow, filter); | 117 this, root, whatToShow, filter); |
147 $endif | 118 $endif |
148 } | 119 } |
OLD | NEW |