Skip to content

For some elements, the form attribute shouldn't be readonly #6165

@KrishnaRPatel

Description

@KrishnaRPatel

https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element:dom-output-htmlfor

readonly attribute HTMLFormElement? form;

However, MDN details how form can be changed, specifically if the is located outside the

element:

The element to associate the output with (its form owner). The value of this attribute must be the id of a <form> in the same document. (If this attribute is not set, the <output> is associated with its ancestor element, if any.)
This attribute lets you associate <output> elements to <form>s anywhere in the document, not just inside a <form>. It can also override an ancestor <form> element.

Other elements that describe the form attribute as readonly while MDN describes how they can be set to a form's id include <input>, <button>, <textarea>, <fieldset>, and <object>.

If these attributes shouldn't be readonly, what would they be? Actually calling Element.form returns the linked form element so it does make sense for it to be treated as a readonly getter. On the other hand, it's misleading because by implementation, it can actually be set with a form id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions