mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement SetNamedItem, SetNamedItemNS, SetAttributeNode and SetAttributeNodeNS
This commit is contained in:
parent
bc44ae679f
commit
322b120f8a
11 changed files with 105 additions and 67 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::attr::Attr;
|
||||
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
use dom::bindings::codegen::Bindings::NamedNodeMapBinding;
|
||||
use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods;
|
||||
use dom::bindings::error::{Error, Fallible};
|
||||
|
@ -58,6 +59,16 @@ impl NamedNodeMapMethods for NamedNodeMap {
|
|||
self.owner.get_attribute(&ns, &Atom::from(&*local_name))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-namednodemap-setnameditem
|
||||
fn SetNamedItem(&self, attr: &Attr) -> Fallible<Option<Root<Attr>>> {
|
||||
self.owner.SetAttributeNode(attr)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-namednodemap-setnameditemns
|
||||
fn SetNamedItemNS(&self, attr: &Attr) -> Fallible<Option<Root<Attr>>> {
|
||||
self.SetNamedItem(attr)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem
|
||||
fn RemoveNamedItem(&self, name: DOMString) -> Fallible<Root<Attr>> {
|
||||
let name = self.owner.parsed_name(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue