Implement SetNamedItem, SetNamedItemNS, SetAttributeNode and SetAttributeNodeNS

This commit is contained in:
Mathieu Hordesseaux 2015-12-23 17:21:45 +01:00
parent bc44ae679f
commit 322b120f8a
11 changed files with 105 additions and 67 deletions

View file

@ -108,12 +108,6 @@
[Element interface: operation hasAttributes()]
expected: FAIL
[Element interface: operation setAttributeNode(Attr)]
expected: FAIL
[Element interface: operation setAttributeNodeNS(Attr)]
expected: FAIL
[Element interface: operation removeAttributeNode(Attr)]
expected: FAIL
@ -126,18 +120,6 @@
[Element interface: element must inherit property "hasAttributes" with the proper type (7)]
expected: FAIL
[Element interface: element must inherit property "setAttributeNode" with the proper type (19)]
expected: FAIL
[Element interface: calling setAttributeNode(Attr) on element with too few arguments must throw TypeError]
expected: FAIL
[Element interface: element must inherit property "setAttributeNodeNS" with the proper type (20)]
expected: FAIL
[Element interface: calling setAttributeNodeNS(Attr) on element with too few arguments must throw TypeError]
expected: FAIL
[Element interface: element must inherit property "removeAttributeNode" with the proper type (21)]
expected: FAIL
@ -156,12 +138,6 @@
[Element interface: calling queryAll(DOMString) on element with too few arguments must throw TypeError]
expected: FAIL
[NamedNodeMap interface: operation setNamedItem(Attr)]
expected: FAIL
[NamedNodeMap interface: operation setNamedItemNS(Attr)]
expected: FAIL
[Range interface: stringifier]
expected: FAIL

View file

@ -1,17 +1,8 @@
[attributes.html]
type: testharness
[Basic functionality of setAttributeNode]
expected: FAIL
[Basic functionality of removeAttributeNode]
expected: FAIL
[setAttributeNode on bound attribute should throw InUseAttributeError]
expected: FAIL
[Basic functionality of setAttributeNodeNS]
expected: FAIL
[getAttributeNames tests]
expected: FAIL
@ -27,12 +18,6 @@
[Own property correctness with two namespaced attributes with the same name-with-prefix]
expected: FAIL
[setAttributeNode, if it fires mutation events, should fire one with the new node when resetting an existing attribute (outer shell)]
expected: FAIL
[setAttributeNode called with an Attr that has the same name as an existing one should not change attribute order]
expected: FAIL
[Own property names should only include all-lowercase qualified names for an HTML element in an HTML document]
expected: FAIL

View file

@ -2013,18 +2013,6 @@
[Element interface: document.createElement("noscript") must inherit property "hasAttributes" with the proper type (7)]
expected: FAIL
[Element interface: document.createElement("noscript") must inherit property "setAttributeNode" with the proper type (19)]
expected: FAIL
[Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError]
expected: FAIL
[Element interface: document.createElement("noscript") must inherit property "setAttributeNodeNS" with the proper type (20)]
expected: FAIL
[Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError]
expected: FAIL
[Element interface: document.createElement("noscript") must inherit property "removeAttributeNode" with the proper type (21)]
expected: FAIL
@ -9101,3 +9089,4 @@
[WebSocket interface: new WebSocket("ws://foo") must inherit property "extensions" with the proper type (10)]
expected: FAIL

View file

@ -12998,3 +12998,4 @@
[dialog.itemId: IDL set to object "test-valueOf" followed by IDL get]
expected: FAIL

View file

@ -59,3 +59,4 @@
[Interfaces for RTC]
expected: FAIL

View file

@ -446,6 +446,26 @@ test(function() {
assert_equals(el2.getAttributeNS("x", "foo"), "bar");
}, "Basic functionality of setAttributeNodeNS")
test(function() {
var el = document.createElement("div");
var other = document.createElement("div");
attr = document.createAttribute("foo");
assert_equals(el.setAttributeNode(attr), null);
assert_equals(attr.ownerElement, el);
assert_throws("INUSE_ATTRIBUTE_ERR",
function() { other.setAttributeNode(attr) },
"Attribute already associated with el")
}, "If attrs element is neither null nor element, throw an InUseAttributeError.");
test(function() {
var el = document.createElement("div");
attr = document.createAttribute("foo");
assert_equals(el.setAttributeNode(attr), null);
el.setAttribute("bar", "qux");
assert_equals(el.setAttributeNode(attr), attr);
assert_equals(el.attributes[0], attr);
}, "Replacing an attr by itself");
test(function() {
var el = document.createElement("div")
el.setAttribute("foo", "bar")