mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Call after_remove_attr before removing the attribute, and rename it before_remove_attr.
This commit is contained in:
parent
fdd17b4139
commit
432e9cb3a7
3 changed files with 12 additions and 12 deletions
|
@ -290,22 +290,22 @@ impl Element {
|
|||
match idx {
|
||||
None => (),
|
||||
Some(idx) => {
|
||||
let removed = self.attrs.remove(idx);
|
||||
let removed_raw_value = removed.get().Value();
|
||||
|
||||
if namespace == namespace::Null {
|
||||
self.after_remove_attr(abstract_self, local_name, removed_raw_value);
|
||||
let removed_raw_value = self.attrs[idx].get().Value();
|
||||
self.before_remove_attr(abstract_self, local_name, removed_raw_value);
|
||||
}
|
||||
|
||||
self.attrs.remove(idx);
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn after_remove_attr(&mut self,
|
||||
abstract_self: &JS<Element>,
|
||||
local_name: DOMString,
|
||||
old_value: DOMString) {
|
||||
fn before_remove_attr(&mut self,
|
||||
abstract_self: &JS<Element>,
|
||||
local_name: DOMString,
|
||||
old_value: DOMString) {
|
||||
match local_name.as_slice() {
|
||||
"style" => {
|
||||
self.style_attribute = None
|
||||
|
@ -328,11 +328,11 @@ impl Element {
|
|||
match abstract_self.get().node.type_id {
|
||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||
let mut elem: JS<HTMLImageElement> = HTMLImageElementCast::to(abstract_self);
|
||||
elem.get_mut().AfterRemoveAttr(local_name.clone());
|
||||
elem.get_mut().BeforeRemoveAttr(local_name.clone());
|
||||
}
|
||||
ElementNodeTypeId(HTMLIframeElementTypeId) => {
|
||||
let mut elem: JS<HTMLIFrameElement> = HTMLIFrameElementCast::to(abstract_self);
|
||||
elem.get_mut().AfterRemoveAttr(local_name.clone());
|
||||
elem.get_mut().BeforeRemoveAttr(local_name.clone());
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ impl HTMLIFrameElement {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn AfterRemoveAttr(&mut self, name: DOMString) {
|
||||
pub fn BeforeRemoveAttr(&mut self, name: DOMString) {
|
||||
if "sandbox" == name {
|
||||
self.sandbox = None;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl HTMLImageElement {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn AfterRemoveAttr(&mut self, name: DOMString) {
|
||||
pub fn BeforeRemoveAttr(&mut self, name: DOMString) {
|
||||
if "src" == name {
|
||||
self.update_image(None, None);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue