New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 834325 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

<picture> elements fire load event on removal

Reported by dar...@verbalplusvisual.com, Apr 18 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Steps to reproduce the problem:
1. Create a picture element with multiple working source child-elements.

2. Attach load event handler to img tag within picture element.

3. Remove picture element or any of its parent elements from DOM

4. Check console logs to see load event firing upon removal of the picture element from the DOM

What is the expected behavior?
Removing a picture element or any of its children should not fire any load events.

What went wrong?
Removing a picture element or any of its children causes firing of load events.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 65.0.3325.181  Channel: n/a
OS Version: OS X 10.13.4
Flash Version: 

Reproduction: https://jsfiddle.net/w0s4xmc0/5330/
 
Labels: OS-Android OS-Chrome OS-Linux OS-Windows
Status: Available (was: Unconfirmed)
That's odd indeed. Attaching the test case in file form.
cr834325.html
1.2 KB View Download
Thanks, that's helpful!

Comment 3 by f...@opera.com, Apr 27 2018

It looks like we are treating this case as a "relevant mutation" [1], even though neither the <source> nor the <img> are actually removed from the <picture> (the <picture> is still their parent.) Hence we shouldn't run the steps to "update the image data". Looks like this case has been conflated with the case where the <source> is actually removed from the <picture>.

[1] https://html.spec.whatwg.org/multipage/images.html#reacting-to-dom-mutations

Comment 4 by f...@opera.com, Apr 27 2018

It looks like this may be covered by the following WPT:

html/semantics/embedded-content/the-img-element/relevant-mutations.html

Sign in to add a comment