mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 14:59:41 +00:00
Omit extra argument to createElement/NS if null
BUG= Review URL: https://codereview.chromium.org//1345413004 .
This commit is contained in:
parent
60b4e00770
commit
0568fa8679
|
@ -9834,13 +9834,32 @@ class Document extends Node
|
|||
|
||||
@DomName('Document.createElement')
|
||||
Element createElement(String tagName, [String typeExtension]) {
|
||||
return _createElement(tagName, typeExtension);
|
||||
if (typeExtension == null) {
|
||||
return _createElement_2(tagName);
|
||||
} else {
|
||||
return _createElement(tagName, typeExtension);
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
@DomName('Document.createElementNS')
|
||||
@DocsEditable()
|
||||
Element createElementNS(String namespaceURI, String qualifiedName, [String typeExtension]) {
|
||||
return _createElementNS(namespaceURI, qualifiedName, typeExtension);
|
||||
if (typeExtension == null) {
|
||||
return _createElementNS_2(namespaceURI, qualifiedName);
|
||||
} else {
|
||||
return _createElementNS(namespaceURI, qualifiedName, typeExtension);
|
||||
}
|
||||
}
|
||||
|
||||
@DomName('Document.createNodeIterator')
|
||||
|
|
|
@ -11065,9 +11065,9 @@ class Document extends Node
|
|||
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;
|
||||
|
@ -11077,7 +11077,7 @@ class Document extends Node
|
|||
wrapped = wrap_jso_custom_element(newElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
|
|
|
@ -381,10 +381,6 @@ speechrecognition_test/supported: Fail
|
|||
touchevent_test/supported: Fail
|
||||
websql_test/supported: Fail
|
||||
|
||||
[ $compiler == dart2js && $runtime == ff && $system == windows ]
|
||||
svgelement_test/innerHtml: RuntimeError # Issue 24386
|
||||
svgelement_test/outerHtml: RuntimeError # Issue 24386
|
||||
|
||||
# 'html' tests import the HTML library, so they only make sense in
|
||||
# a browser environment.
|
||||
[ $runtime == vm ]
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue