-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
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
The element to associate the
outputwith (its form owner). The value of this attribute must be theidof 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.