Bug 129742 - Form-association for <img> is inconsistent
Summary: Form-association for <img> is inconsistent
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL: data:text/html,<div id=willBeRemoved>...
Keywords: BlinkMergeCandidate, InRadar
Depends on:
Blocks:
 
Reported: 2014-03-05 09:49 PST by David Kilzer (:ddkilzer)
Modified: 2022-11-13 20:33 PST (History)
13 users (show)

See Also:


Attachments
WIP (5.11 KB, patch)
2022-11-12 22:30 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2014-03-05 09:49:31 PST
From <https://code.google.com/p/chromium/issues/detail?id=336317>:

Version: all (ancient WebKit bug)
OS: all

What steps will reproduce the problem?
1. Open the following URL:

data:text/html,<div id=willBeRemoved> <div> <form id=f1> <input id=in1> <img id=im1> </div> <input id=in3> <img id=im3> </div> <input id=in2> <img id=im2> <script>var f = document.getElementById('f1'); var d=document.getElementById('willBeRemoved'); d.parentNode.removeChild(d); alert('' + f['im1'] + ',' + f['im2'] + ',' + f['im3']);</script>

What is the expected output? What do you see instead?
Expected: Alert "[object HTMLImageElement],undefined,[object HTMLImageElement]" according to the standard and Firefox.
Actual: Alert "undefined,[object HTMLImageElement],undefined"
Comment 1 David Kilzer (:ddkilzer) 2014-03-05 09:49:53 PST
<rdar://problem/16220093>
Comment 2 David Kilzer (:ddkilzer) 2014-03-05 09:54:13 PST
Merge candidate:  <http://src.chromium.org/viewvc/blink?view=rev&rev=165436>
Comment 3 Ahmad Saleem 2022-08-21 01:06:30 PDT
I am able to reproduce this using test case changed into JSFiddle:

Link - https://jsfiddle.net/jscdb4mu/

Outputs across all browsers:

*** Safari 15.6.1 on macOS 12.5.1 ***

undefined,[object HTMLImageElement],undefined

*** Safari Technology Preview 151 ***

undefined,[object HTMLImageElement],undefined

*** Firefox Nightly 105 ***

[object HTMLImageElement],undefined,[object HTMLImageElement]

*** Chrome Canary 106 ***

[object HTMLImageElement],undefined,[object HTMLImageElement]

__________________

Just wanted to share updated test results. Thanks!
Comment 4 Ryosuke Niwa 2022-11-12 22:30:09 PST
Created attachment 463504 [details]
WIP
Comment 5 Ryosuke Niwa 2022-11-13 14:13:29 PST
Pull request: https://github.com/WebKit/WebKit/pull/6447
Comment 6 EWS 2022-11-13 20:33:11 PST
Committed 256629@main (36537bb39ed8): <https://commits.webkit.org/256629@main>

Reviewed commits have been landed. Closing PR #6447 and removing active labels.