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);

View file

@ -6,12 +6,6 @@
[slot on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL
[setAttributeNode on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL
[setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL
[insertAdjacentHTML on Element must enqueue a connected reaction for a newly constructed custom element]
expected: FAIL

View file

@ -1,8 +0,0 @@
[NamedNodeMap.html]
type: testharness
[setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL
[setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL

View file

@ -1,6 +1,5 @@
[get-computed-style-for-url.html]
type: testharness
[getComputedStyle(elem) for url() listStyle uses the resolved URL and elem.style uses the original URL]
expected: FAIL
bug: https://github.com/servo/servo/issues/18015