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
|
@ -193,16 +193,12 @@ impl Attr {
|
|||
pub fn set_owner(&self, owner: Option<&Element>) {
|
||||
let ns = &self.identifier.namespace;
|
||||
match (self.owner().r(), owner) {
|
||||
(None, Some(new)) => {
|
||||
// Already in the list of attributes of new owner.
|
||||
assert!(new.get_attribute(&ns, &self.identifier.local_name) ==
|
||||
Some(Root::from_ref(self)))
|
||||
}
|
||||
(Some(old), None) => {
|
||||
// Already gone from the list of attributes of old owner.
|
||||
assert!(old.get_attribute(&ns, &self.identifier.local_name).is_none())
|
||||
assert!(old.get_attribute(&ns, &self.identifier.local_name).r() != Some(self))
|
||||
}
|
||||
(old, new) => assert!(old == new),
|
||||
(Some(old), Some(new)) => assert!(old == new),
|
||||
_ => {},
|
||||
}
|
||||
self.owner.set(owner);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue