Bug 223712

Summary: HTMLFormElement.elements should not return images
Product: WebKit Reporter: Marvin Scholz <epirat07>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cdumez, gsnedders, wenson_hsieh
Priority: P2    
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   

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 ***