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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Document.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Document.darttemplate b/tools/dom/templates/html/impl/impl_Document.darttemplate
index d803f8e783d43ee32eacb9a84da34b4f6e9f0b1d..fb6d6b1889059268f5cada3b37301a8fb03ecddd 100644
--- a/tools/dom/templates/html/impl/impl_Document.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Document.darttemplate
@@ -64,7 +64,11 @@ $endif
@DomName('Document.createElement')
Element createElement(String tagName, [String typeExtension]) {
$if DART2JS
- return _createElement(tagName, typeExtension);
+ if (typeExtension == null) {
+ return _createElement_2(tagName);
+ } else {
+ return _createElement(tagName, typeExtension);
+ }
$else
var newElement = (typeExtension == null) ?
_blink.BlinkDocument.instance.createElement_Callback_1_(unwrap_jso(this), tagName) :
@@ -86,18 +90,35 @@ $else
$endif
}
+$if DART2JS
+ // The two-argument version of this is automatically generated, but we need to
+ // omit the typeExtension if it's null on Firefox or we get an is="null" attribute.
+ @DomName('Document.createElement')
+ _createElement_2(String tagName) => JS('', '#.createElement(#)', this, tagName);
+
+ // The three-argument version of this is automatically generated, but we need to
+ // omit the typeExtension if it's null on Firefox or we get an is="null" attribute.
+ @DomName('Document.createElementNS')
+ _createElementNS_2(String namespaceURI, String qualifiedName) =>
+ JS('', '#.createElementNS(#, #)', this, namespaceURI, qualifiedName);
+
+$endif
@DomName('Document.createElementNS')
@DocsEditable()
Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) {
$if DART2JS
- return _createElementNS(namespaceURI, qualifiedName, typeExtension);
+ if (typeExtension == null) {
+ return _createElementNS_2(namespaceURI, qualifiedName);
+ } else {
+ return _createElementNS(namespaceURI, qualifiedName, typeExtension);
+ }
$else
var newElement = (typeExtension == null) ?
_blink.BlinkDocument.instance.createElementNS_Callback_2_(unwrap_jso(this), namespaceURI, qualifiedName) :
_blink.BlinkDocument.instance.createElementNS_Callback_3_(unwrap_jso(this), namespaceURI, qualifiedName, typeExtension);
-
+
var wrapped;
-
+
if (newElement['dart_class'] != null) {
wrapped = newElement['dart_class']; // Here's our Dart class.
wrapped.blink_jsObject = newElement;
@@ -107,7 +128,7 @@ $else
wrapped = wrap_jso_custom_element(newElement);
}
}
-
+
return wrapped;
$endif
}
« 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