diff options
Diffstat (limited to 'components/script/dom/attr.rs')
-rw-r--r-- | components/script/dom/attr.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 95ff73e2cb7..43c1226b295 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -173,13 +173,18 @@ impl Attr { pub fn set_value(&self, mut value: AttrValue, owner: &Element) { assert!(Some(owner) == self.owner().r()); owner.will_mutate_attr(); - mem::swap(&mut *self.value.borrow_mut(), &mut value); + self.swap_value(&mut value); if self.identifier.namespace == ns!() { vtable_for(owner.upcast()) .attribute_mutated(self, AttributeMutation::Set(Some(&value))); } } + /// Used to swap the attribute's value without triggering mutation events + pub fn swap_value(&self, value: &mut AttrValue) { + mem::swap(&mut *self.value.borrow_mut(), value); + } + pub fn identifier(&self) -> &AttrIdentifier { &self.identifier } |