aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/script/dom/htmlimageelement.rs7
-rw-r--r--src/test/ref/basic.list1
-rw-r--r--src/test/ref/img_dynamic_remove.html5
-rw-r--r--src/test/ref/img_dynamic_remove_ref.html2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/components/script/dom/htmlimageelement.rs b/src/components/script/dom/htmlimageelement.rs
index 61add6b1d7a..4f18597449c 100644
--- a/src/components/script/dom/htmlimageelement.rs
+++ b/src/components/script/dom/htmlimageelement.rs
@@ -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);
}
diff --git a/src/test/ref/basic.list b/src/test/ref/basic.list
index e3e7997a5ae..661974e2996 100644
--- a/src/test/ref/basic.list
+++ b/src/test/ref/basic.list
@@ -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
diff --git a/src/test/ref/img_dynamic_remove.html b/src/test/ref/img_dynamic_remove.html
new file mode 100644
index 00000000000..9400764fcd4
--- /dev/null
+++ b/src/test/ref/img_dynamic_remove.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<img src=400x400_green.png>
+<script>
+document.getElementsByTagName("img")[0].removeAttribute("src");
+</script>
diff --git a/src/test/ref/img_dynamic_remove_ref.html b/src/test/ref/img_dynamic_remove_ref.html
new file mode 100644
index 00000000000..6976ec6f2f4
--- /dev/null
+++ b/src/test/ref/img_dynamic_remove_ref.html
@@ -0,0 +1,2 @@
+<!doctype html>
+<img>