mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement Document::CreateAttributeNS()
This commit is contained in:
parent
7b4f6126c8
commit
2353bc4798
4 changed files with 17 additions and 18 deletions
|
@ -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)
|
||||
|
|
|
@ -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_);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue