Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: tools/dom/templates/html/impl/impl_Document.darttemplate

Issue 1345413004: Omit extra argument to createElement/NS if null (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove test suppression Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 $endif 57 $endif
58 } 58 }
59 59
60 /// *Deprecated*: use [supportsRegisterElement] instead. 60 /// *Deprecated*: use [supportsRegisterElement] instead.
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 _createElement(tagName, typeExtension); 67 if (typeExtension == null) {
68 return _createElement_2(tagName);
69 } else {
70 return _createElement(tagName, typeExtension);
71 }
68 $else 72 $else
69 var newElement = (typeExtension == null) ? 73 var newElement = (typeExtension == null) ?
70 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) : 74 _blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) :
71 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension); 75 _blink.BlinkDocument.instance.createElement_Callback_2_(unwrap_jso(this), tagName, typeExtension);
72 76
73 var wrapped; 77 var wrapped;
74 78
75 if (newElement['dart_class'] != null) { 79 if (newElement['dart_class'] != null) {
76 wrapped = newElement['dart_class']; // Here's our Dart class. 80 wrapped = newElement['dart_class']; // Here's our Dart class.
77 wrapped.blink_jsObject = newElement; 81 wrapped.blink_jsObject = newElement;
78 } else { 82 } else {
79 wrapped = wrap_jso(newElement); 83 wrapped = wrap_jso(newElement);
80 if (wrapped == null) { 84 if (wrapped == null) {
81 wrapped = wrap_jso_custom_element(newElement); 85 wrapped = wrap_jso_custom_element(newElement);
82 } 86 }
83 } 87 }
84 88
85 return wrapped; 89 return wrapped;
86 $endif 90 $endif
87 } 91 }
88 92
93 $if DART2JS
94 // The two-argument version of this is automatically generated, but we need to
95 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute.
96 @DomName('Document.createElement')
97 _createElement_2(String tagName) => JS('', '#.createElement(#)', this, tagName );
98
99 // The three-argument version of this is automatically generated, but we need to
100 // omit the typeExtension if it's null on Firefox or we get an is="null" attri bute.
101 @DomName('Document.createElementNS')
102 _createElementNS_2(String namespaceURI, String qualifiedName) =>
103 JS('', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName);
104
105 $endif
89 @DomName('Document.createElementNS') 106 @DomName('Document.createElementNS')
90 @DocsEditable() 107 @DocsEditable()
91 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) { 108 Element createElementNS(String namespaceURI, String qualifiedName, [String typ eExtension]) {
92 $if DART2JS 109 $if DART2JS
93 return _createElementNS(namespaceURI, qualifiedName, typeExtension); 110 if (typeExtension == null) {
111 return _createElementNS_2(namespaceURI, qualifiedName);
112 } else {
113 return _createElementNS(namespaceURI, qualifiedName, typeExtension);
114 }
94 $else 115 $else
95 var newElement = (typeExtension == null) ? 116 var newElement = (typeExtension == null) ?
96 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) : 117 _blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this) , namespaceURI, qualifiedName) :
97 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension); 118 _blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this) , namespaceURI, qualifiedName, typeExtension);
98 119
99 var wrapped; 120 var wrapped;
100 121
101 if (newElement['dart_class'] != null) { 122 if (newElement['dart_class'] != null) {
102 wrapped = newElement['dart_class']; // Here's our Dart class. 123 wrapped = newElement['dart_class']; // Here's our Dart class.
103 wrapped.blink_jsObject = newElement; 124 wrapped.blink_jsObject = newElement;
104 } else { 125 } else {
105 wrapped = wrap_jso(newElement); 126 wrapped = wrap_jso(newElement);
106 if (wrapped == null) { 127 if (wrapped == null) {
107 wrapped = wrap_jso_custom_element(newElement); 128 wrapped = wrap_jso_custom_element(newElement);
108 } 129 }
109 } 130 }
110 131
111 return wrapped; 132 return wrapped;
112 $endif 133 $endif
113 } 134 }
114 135
115 $if DART2JS 136 $if DART2JS
116 @DomName('Document.createNodeIterator') 137 @DomName('Document.createNodeIterator')
117 NodeIterator _createNodeIterator(Node root, 138 NodeIterator _createNodeIterator(Node root,
118 [int whatToShow, NodeFilter filter]) 139 [int whatToShow, NodeFilter filter])
119 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)', 140 => JS('NodeIterator', '#.createNodeIterator(#, #, #, false)',
120 this, root, whatToShow, filter); 141 this, root, whatToShow, filter);
121 142
122 @DomName('Document.createTreeWalker') 143 @DomName('Document.createTreeWalker')
123 TreeWalker _createTreeWalker(Node root, 144 TreeWalker _createTreeWalker(Node root,
124 [int whatToShow, NodeFilter filter]) 145 [int whatToShow, NodeFilter filter])
125 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)', 146 => JS('TreeWalker', '#.createTreeWalker(#, #, #, false)',
126 this, root, whatToShow, filter); 147 this, root, whatToShow, filter);
127 $endif 148 $endif
128 } 149 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698