Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
LayoutTests/imported/w3c:
Element's attribute NS API should treat defined undefined namespace as null
https://bugs.webkit.org/show_bug.cgi?id=149238
<rdar://problem/22562204>

Reviewed by Ryosuke Niwa.

Rebaseline W3C DOM test that one more check is passing.

* web-platform-tests/dom/nodes/attributes-expected.txt:

Source/WebCore:
Element's attribute NS API should defined treat undefined namespace as null
https://bugs.webkit.org/show_bug.cgi?id=149238
<rdar://problem/22562204>

Reviewed by Ryosuke Niwa.

Element's attribute NS API should treat defined undefined namespace as null
instead of converting it to the "undefined" String. This is because the
namespace parameter is a nullable String as per the DOM spec:
- https://dom.spec.whatwg.org/#element

The attribute is nullable and WebIDL says undefined should be converted
to null for nullable parameters:
- https://heycam.github.io/webidl/#es-nullable-type (step 3)

Firefox follows the specification.

No new tests, already covered by existing test.

* dom/Element.idl:

Canonical link: https://commits.webkit.org/167345@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189893 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Sep 17, 2015
1 parent f41b004 commit e9b9faf
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 6 deletions.
12 changes: 12 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
@@ -1,3 +1,15 @@
2015-09-16 Chris Dumez <cdumez@apple.com>

Element's attribute NS API should treat defined undefined namespace as null
https://bugs.webkit.org/show_bug.cgi?id=149238
<rdar://problem/22562204>

Reviewed by Ryosuke Niwa.

Rebaseline W3C DOM test that one more check is passing.

* web-platform-tests/dom/nodes/attributes-expected.txt:

2015-09-15 Chris Dumez <cdumez@apple.com>

Document.createElement(localName) does not handle correctly missing or null parameter
Expand Down
Expand Up @@ -33,7 +33,7 @@ PASS Only lowercase attributes are returned on HTML elements (upper case attribu
PASS Only lowercase attributes are returned on HTML elements (mixed case attribute)
PASS First set attribute is returned with mapped attribute set first
PASS First set attribute is returned with mapped attribute set later
FAIL Non-HTML element with upper-case attribute assert_equals: el.hasAttributeNS(undefined) expected true but got false
PASS Non-HTML element with upper-case attribute
PASS Attribute with prefix in local name
PASS Attribute loses its owner when removed

23 changes: 23 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,26 @@
2015-09-16 Chris Dumez <cdumez@apple.com>

Element's attribute NS API should defined treat undefined namespace as null
https://bugs.webkit.org/show_bug.cgi?id=149238
<rdar://problem/22562204>

Reviewed by Ryosuke Niwa.

Element's attribute NS API should treat defined undefined namespace as null
instead of converting it to the "undefined" String. This is because the
namespace parameter is a nullable String as per the DOM spec:
- https://dom.spec.whatwg.org/#element

The attribute is nullable and WebIDL says undefined should be converted
to null for nullable parameters:
- https://heycam.github.io/webidl/#es-nullable-type (step 3)

Firefox follows the specification.

No new tests, already covered by existing test.

* dom/Element.idl:

2015-09-16 Chris Dumez <cdumez@apple.com>

Possible small iOS PLT regression from r189537
Expand Down
10 changes: 5 additions & 5 deletions Source/WebCore/dom/Element.idl
Expand Up @@ -49,24 +49,24 @@

// DOM Level 2 Core

[ObjCLegacyUnnamedParameters, TreatReturnedNullStringAs=Null] DOMString getAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[ObjCLegacyUnnamedParameters, TreatReturnedNullStringAs=Null] DOMString getAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[ObjCLegacyUnnamedParameters, RaisesException] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[ObjCLegacyUnnamedParameters, RaisesException] void setAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString qualifiedName,
[Default=Undefined] optional DOMString value);
[ObjCLegacyUnnamedParameters] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI,
[ObjCLegacyUnnamedParameters] void removeAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString namespaceURI,
DOMString localName);

#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
[ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
#else
HTMLCollection getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName);
#endif
[ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);
[RaisesException] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr);
boolean hasAttribute(DOMString name);
[ObjCLegacyUnnamedParameters] boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI,
[ObjCLegacyUnnamedParameters] boolean hasAttributeNS([TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString namespaceURI,
[Default=Undefined] optional DOMString localName);

readonly attribute CSSStyleDeclaration style;
Expand Down

0 comments on commit e9b9faf

Please sign in to comment.