Handle removing the src attribute from an img element (fixes #1469).

This commit is contained in:
Ms2ger 2014-02-25 19:33:49 +01:00
parent 9faf2c89e4
commit 938f6baf9e
4 changed files with 11 additions and 4 deletions

View file

@ -70,7 +70,9 @@ impl HTMLImageElement {
let window = document.get().window.get();
let image_cache = &window.image_cache_task;
match value {
None => {}
None => {
self.extra.image = None;
}
Some(src) => {
let img_url = parse_url(src, url);
self.extra.image = Some(img_url.clone());
@ -95,9 +97,6 @@ impl HTMLImageElement {
}
pub fn AfterRemoveAttr(&mut self, name: DOMString) {
// FIXME (#1469):
// This might not handle remove src attribute actually since
// `self.update_image()` will see the missing src attribute and return early.
if "src" == name {
self.update_image(None, None);
}

View file

@ -23,6 +23,7 @@
== font_size_percentage.html font_size_em_ref.html
== position_fixed_a.html position_fixed_b.html
== img_size_a.html img_size_b.html
== img_dynamic_remove.html img_dynamic_remove_ref.html
== upper_id_attr.html upper_id_attr_ref.html
# inline_border_a.html inline_border_b.html
== anon_block_inherit_a.html anon_block_inherit_b.html

View file

@ -0,0 +1,5 @@
<!doctype html>
<img src=400x400_green.png>
<script>
document.getElementsByTagName("img")[0].removeAttribute("src");
</script>

View file

@ -0,0 +1,2 @@
<!doctype html>
<img>