Bug 87834 - form.elements should not contain image elements.
Summary: form.elements should not contain image elements.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rakesh
URL:
Keywords: BrowserCompat, InRadar, WebExposed
: 223712 249852 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-05-30 01:51 PDT by Rakesh
Modified: 2024-02-08 15:39 PST (History)
11 users (show)

See Also:


Attachments
Proposed patch (7.89 KB, patch)
2012-05-30 02:16 PDT, Rakesh
no flags Details | Formatted Diff | Diff
Updated patch (15.58 KB, patch)
2012-05-30 05:34 PDT, Rakesh
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-04 (821.26 KB, application/zip)
2012-05-30 10:56 PDT, WebKit Review Bot
no flags Details
Updated patch (11.46 KB, patch)
2012-06-01 06:16 PDT, Rakesh
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-04 (753.21 KB, application/zip)
2012-06-01 10:52 PDT, WebKit Review Bot
no flags Details
Updated patch (13.03 KB, patch)
2012-06-04 00:43 PDT, Rakesh
no flags Details | Formatted Diff | Diff
GitHub Patch Screenshot (838.66 KB, image/png)
2023-05-08 16:38 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rakesh 2012-05-30 01:51:45 PDT
Image elements should not appear in the form.elements as image element is not mentioned in listed elements of specs http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-listed.
Comment 1 Rakesh 2012-05-30 02:16:58 PDT
Created attachment 144760 [details]
Proposed patch
Comment 2 Kent Tamura 2012-05-30 02:24:28 PDT
Comment on attachment 144760 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144760&action=review

I know the standard and other browsers don't have this behavior.  But I'm not sure it's ok to remove this because this is an incompatible change.


> Source/WebCore/html/HTMLFormElement.h:113
>      const Vector<FormAssociatedElement*>& associatedElements() const { return m_associatedElements; }
> -    const Vector<HTMLImageElement*>& imageElements() const { return m_imageElements; }
>  

You can remove m_imageElements, registerImgElement(), and removeImgElement().
Also, you can remove HTMLImageElement::m_form and HTMLImageElement::removedFrom()
Comment 3 Rakesh 2012-05-30 03:00:21 PDT
(In reply to comment #2)
Thanks for your inputs.

> I know the standard and other browsers don't have this behavior.  But I'm not sure it's ok to remove this because this is an incompatible change.
> 
> You can remove m_imageElements, registerImgElement(), and removeImgElement().
The specs has some point as follows:
When a form element is indexed for named property retrieval .. :

2. If candidates is empty, let candidates be a live RadioNodeList object containing all the img elements that are descendants of the form element and that have either an id attribute or a name attribute equal to name, in tree order.

May be m_imageElement might be useful here but yes it is better to remove those and specs compatibility can be done in another bug.

> Also, you can remove HTMLImageElement::m_form and HTMLImageElement::removedFrom()

Yes, as img element does not fall under form-associated elements category, we may have to remove above code also.
Comment 4 Rakesh 2012-05-30 05:34:46 PDT
Created attachment 144788 [details]
Updated patch

Removed the Form element related code from HTMLImageElement
Comment 5 WebKit Review Bot 2012-05-30 10:56:13 PDT
Comment on attachment 144788 [details]
Updated patch

Attachment 144788 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12844934

New failing tests:
fast/forms/form-image-access-by-name.html
fast/forms/reparented-image-as-property.html
Comment 6 WebKit Review Bot 2012-05-30 10:56:17 PDT
Created attachment 144866 [details]
Archive of layout-test-results from ec2-cr-linux-04

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-04  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 7 Alexey Proskuryakov 2012-05-30 13:51:36 PDT
> fast/forms/form-image-access-by-name.html
> fast/forms/reparented-image-as-property.html

These both pass in Firefox.
Comment 8 Darin Adler 2012-05-30 14:03:13 PDT
(In reply to comment #2)
> I know the standard and other browsers don't have this behavior.

According to Alexey’s test results, Firefox has at least some of “this behavior”.
Comment 9 Rakesh 2012-05-31 11:58:42 PDT
(In reply to comment #7)

> These both pass in Firefox.
Thanks Alexey for your inputs.
> 
> According to Alexey’s test results, Firefox has at least some of “this behavior”.

Thanks Darin.
It looks like the issue may be the way we handle nameGetter of form object. We use the same HTMLFormCollection:::namedItems functions for both the FormCollection's nameGetter and as well as HTMLFormElement's nameGetter.
May be we should handle them differently.
Comment 10 Ryosuke Niwa 2012-06-01 00:01:47 PDT
Comment on attachment 144788 [details]
Updated patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144788&action=review

r- per comments #7 #9. Please update a new patch that doesn't regress the compatibility with IE and FF.

> Source/WebCore/ChangeLog:8
> +        Removed support for image elements from HTMLFormCollection  as image elements

Nit: two spaces before "as".
Comment 11 Kent Tamura 2012-06-01 03:54:32 PDT
Ah, I misunderstood the situation.
  formElement.<name> should support img elements.  It's defined by the standard.
  formElement.elements.<name> or formElement.elements.namedItem(<name>) works in WebKit, but it's not defined byt the standard and other browsers don't support.
Comment 12 Rakesh 2012-06-01 06:16:19 PDT
Created attachment 145288 [details]
Updated patch

Handled regressions, now formElement.<name> will support img elements
Comment 13 WebKit Review Bot 2012-06-01 10:52:43 PDT
Comment on attachment 145288 [details]
Updated patch

Attachment 145288 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12861704

New failing tests:
http/tests/media/media-source/video-media-source-event-attributes.html
fast/forms/form-collection-elements.html
Comment 14 WebKit Review Bot 2012-06-01 10:52:47 PDT
Created attachment 145339 [details]
Archive of layout-test-results from ec2-cr-linux-04

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-04  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 15 Rakesh 2012-06-01 11:47:39 PDT
(In reply to comment #13)
> New failing tests:
> http/tests/media/media-source/video-media-source-event-attributes.html
Not sure why this is failing, will check.

> fast/forms/form-collection-elements.html
Missed updating expected.txt, will do that.
Comment 16 Rakesh 2012-06-04 00:43:15 PDT
Created attachment 145528 [details]
Updated patch

Updated form-collection-elements-expected.txt. http/tests/media/media-source/video-media-source-event-attributes.html is not failing on my build, may be it will pass now.
Comment 17 Rakesh 2012-06-19 00:29:36 PDT
ping! review?
Comment 18 Sam Sneddon [:gsnedders] 2021-03-27 08:39:52 PDT
*** Bug 223712 has been marked as a duplicate of this bug. ***
Comment 19 Ahmad Saleem 2022-12-23 15:47:11 PST
*** Bug 249852 has been marked as a duplicate of this bug. ***
Comment 20 Ahmad Saleem 2023-05-08 16:38:44 PDT
Created attachment 466290 [details]
GitHub Patch Screenshot

Test Case - https://jsfiddle.net/7dfsnp23/show (from bug 249852)

^ This test passes if I do attached screenshots (GitHub Desktop) changes on local and compile the build. I haven't run all tests to see if it causes any other issue. Happy to do "Draft" PR to run through EWS, if it has any impact.
Comment 21 Ahmad Saleem 2023-05-09 13:26:29 PDT
(In reply to Ahmad Saleem from comment #20)
> Created attachment 466290 [details]
> GitHub Patch Screenshot
> 
> Test Case - https://jsfiddle.net/7dfsnp23/show (from bug 249852)
> 
> ^ This test passes if I do attached screenshots (GitHub Desktop) changes on
> local and compile the build. I haven't run all tests to see if it causes any
> other issue. Happy to do "Draft" PR to run through EWS, if it has any impact.

I did this PR - https://github.com/WebKit/WebKit/pull/13613

I think I will not be able to fix remaining failing tests so I will close my PR after this EWS run.

If someone want to take a jab and fix remaining test cases, it would be great.

form-associated-element.html <- Test taken from Chromium / Blink (if I am not mistaken)

image-named-access.html

reparented-image-as-property.html
Comment 22 Radar WebKit Bug Importer 2024-02-08 15:39:32 PST
<rdar://problem/122588036>