Enqueue attribute changed callback when replacing attr

This commit is contained in:
Connor Brewster 2017-08-14 16:11:56 -05:00
parent 4d22af6136
commit 221b099db4
4 changed files with 9 additions and 15 deletions

View file

@ -1674,6 +1674,15 @@ impl ElementMethods for Element {
}
// Step 4.
if self.get_custom_element_definition().is_some() {
let old_name = old_attr.local_name().clone();
let old_value = DOMString::from(&**old_attr.value());
let new_value = DOMString::from(&**attr.value());
let namespace = old_attr.namespace().clone();
let reaction = CallbackReaction::AttributeChanged(old_name, Some(old_value),
Some(new_value), namespace);
ScriptThread::enqueue_callback_reaction(self, reaction, None);
}
self.will_mutate_attr(attr);
attr.set_owner(Some(self));
self.attrs.borrow_mut()[position] = JS::from_ref(attr);