Bug 223712 - HTMLFormElement.elements should not return images
Summary: HTMLFormElement.elements should not return images
Status: RESOLVED DUPLICATE of bug 87834
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-24 13:55 PDT by Marvin Scholz
Modified: 2021-03-27 08:39 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Scholz 2021-03-24 13:55:52 PDT
According to https://html.spec.whatwg.org/multipage/forms.html#category-listed the HTMLFormElement elements
property should not list img elements in forms, this does seem to work fine, except when explicitly accessing by ID.

For example given the following HTML:

    <form id="test_form">
        <input type="text" name="example_text_input">
        <img alt="example" id="test_img" width="10" height="10" src="…">
    </form>

Querying the elements with the img id like this:

    document.forms['test_form'].elements['test_img']

should return undefined, like it happens in other browsers (tested with Firefox and Chrome), but it actually returns the img element.

Possibly related to #87834
Comment 1 Sam Sneddon [:gsnedders] 2021-03-27 08:39:52 PDT

*** This bug has been marked as a duplicate of bug 87834 ***