mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Handle removing the src attribute from an img element (fixes #1469).
This commit is contained in:
parent
9faf2c89e4
commit
938f6baf9e
4 changed files with 11 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
5
src/test/ref/img_dynamic_remove.html
Normal file
5
src/test/ref/img_dynamic_remove.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!doctype html>
|
||||
<img src=400x400_green.png>
|
||||
<script>
|
||||
document.getElementsByTagName("img")[0].removeAttribute("src");
|
||||
</script>
|
2
src/test/ref/img_dynamic_remove_ref.html
Normal file
2
src/test/ref/img_dynamic_remove_ref.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<img>
|
Loading…
Add table
Add a link
Reference in a new issue