Implement Document::CreateAttributeNS()

This commit is contained in:
Anthony Ramine 2015-04-08 02:00:18 +02:00
parent 7b4f6126c8
commit 2353bc4798
4 changed files with 17 additions and 18 deletions

View file

@ -997,6 +997,18 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Ok(Attr::new(window.r(), name, value, l_name, ns!(""), None, None))
}
// http://dom.spec.whatwg.org/#dom-document-createattributens
fn CreateAttributeNS(self, namespace: Option<DOMString>, qualified_name: DOMString)
-> Fallible<Temporary<Attr>> {
let (namespace, prefix, local_name) =
try!(validate_and_extract(namespace, &qualified_name));
let window = self.window.root();
let value = AttrValue::String("".to_owned());
let qualified_name = Atom::from_slice(&qualified_name);
Ok(Attr::new(window.r(), local_name, value, qualified_name,
namespace, prefix, None))
}
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
fn CreateDocumentFragment(self) -> Temporary<DocumentFragment> {
DocumentFragment::new(self)

View file

@ -40,14 +40,16 @@ interface Document : Node {
[NewObject, Throws]
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
[NewObject, Throws]
Attr createAttribute(DOMString localName);
[NewObject, Throws]
Node importNode(Node node, optional boolean deep = false);
[Throws]
Node adoptNode(Node node);
[NewObject, Throws]
Attr createAttribute(DOMString localName);
[NewObject, Throws]
Attr createAttributeNS(DOMString? namespace, DOMString localName);
[NewObject, Throws]
Event createEvent(DOMString interface_);

View file

@ -90,9 +90,6 @@
[Document interface: operation importNode(Node,boolean)]
expected: FAIL
[Document interface: operation createAttributeNS(DOMString,DOMString)]
expected: FAIL
[Document interface: operation createNodeIterator(Node,unsigned long,NodeFilter)]
expected: FAIL
@ -141,9 +138,6 @@
[Document interface: xmlDoc must inherit property "origin" with the proper type (3)]
expected: FAIL
[Document interface: calling createAttributeNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError]
expected: FAIL
[Document interface: calling createNodeIterator(Node,unsigned long,NodeFilter) on xmlDoc with too few arguments must throw TypeError]
expected: FAIL
@ -1020,9 +1014,6 @@
[DOMTokenList interface object length]
expected: FAIL
[Document interface: xmlDoc must inherit property "createAttributeNS" with the proper type (22)]
expected: FAIL
[Document interface: xmlDoc must inherit property "createNodeIterator" with the proper type (25)]
expected: FAIL

View file

@ -1035,12 +1035,6 @@
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "origin" with the proper type (3)]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttributeNS" with the proper type (22)]
expected: FAIL
[Document interface: calling createAttributeNS(DOMString,DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "createNodeIterator" with the proper type (25)]
expected: FAIL