In order to answer the question, we need to understand:
- Why do inline handlers and regulars behave differently?
Described in detail in this section of the specification.
Inline handler, this is generally not a script yet, it has yet to be turned into a script. And how this is done is described in the specification here . Pay attention to point 10:
Lexical Environment Scope
1. Let Scope be the result of the NewObjectEnvironment (document, the global environment).
2. If the form owner is not null, let Scope be the result of the NewObjectEnvironment (> form owner, Scope).
3. If the element is not null, let Scope be the result of the NewObjectEnvironment (element, Scope).
That is, in our lexical environment (in simple language, the variables available in the function), "variable forms" are suddenly mixed in here.
- What are these "variable forms" like ?
Where does the name of the input come from in them if I did not write them directly in the form tag?
When you do say document.getElementById('someid') you get not just a line of html, but some strange thing that has unexpected properties.
So, this thing is a separate layer of abstraction. It is at this level that the "object" of the form is enriched with properties containing references to its associated controls (and all sorts of other useful things).
In the specification, if you need to know what will be in this object, you usually need to search for the keywords "IDL attributes". I once answered about them here , the truth is rather tongue-tied.
- Ok, and where is it written that the variable forms fall on the name?
In the interface that the form must implement.
Further on in the course of section 4.10.3 this is declared more fully.
There is a special "human" explanation in the same section in the non-standard section:
form [name] Returns the form control; or, if there are none, returns the img element with the given ID.
Once an element has been used, it has been referenced using the document.
If there are multiple matching items, then a RadioNodeList object containing all those elements is returned.
Who would have told me about five years ago that I would read with a huge interest for the night html spec, I would have twisted my wing at my temple.
thisobject takes one value, with another record another one ...? - CodeGust