[whatwg] HTML 5 : Misconceptions Documented
giecrilj at stegny.2a.pl
Mon Aug 11 12:54:05 PDT 2008
Neither the expression 'form.elements.$name' nor its expanded form
'form.elements["$name"]' is supposed to be defined even if $name is an
identifier of an embedded control. The correct way to address the control
is 'form.elements("$name")', which is a shorthand notation for
'form.elements.item("$name")'. These two should not be confused.
Therefore, the bug in Opera is not about shadowing the length property but
about defining the corresponding property at all (in particular,
'form.elements.ell' should be null no matter what).
OTOH, the expression 'form.length' is a perfect equivalent for
'form.elements("length")', provided a control with such a name is contained.
Have you reported this to Opera technical support?
I can see no harm in principle in assigning a value to 'form.length' because
length is not an intrinsic property the form object.
From: whatwg-bounces at lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Garrett Smith
Sent: Saturday, August 09, 2008 2:06 AM
To: WHATWG List
Cc: Maciej Stachowiak
Subject: Re: [whatwg] HTML 5 : Misconceptions Documented
On Thu, Aug 7, 2008 at 4:37 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> On Aug 7, 2008, at 3:44 PM, Garrett Smith wrote:
I'd like to put this back on the list, and it doesn't contain anything
personal, so I'm taking the liberty here.
> I'm not sure what you mean by "in the binding".
I meant the EcmaScript binding.
> Do you mean in Web IDL's
> definition of how to map Web IDL interfaces to the ECMAScript language, or
> one-off in the HTML5 spec for every interface this applies to?
Narrowing the scope in the interest of not creating bugs seems like a
very good idea.
This could potentially be described in the EcmaScript bindings. But it
would be a good idea to explore some edge cases. Particularly, if the
case was the order of definition of properties: One such case would be
an HTMLCollection with an element named "length". In that case, the
readonly "length" property would have to be the actual length of the
collection; the value should not be replaced with an element of that
Opera9: [object HTMLInputElement] <-- BUG
Another consideration would be a form element with an attribute
"length". That would be a problem as neither the attribute, nor the
Netscape 4 DOM "named items" are specified as "readonly". So that's
one reason for not specifying the Netscape 4 DOM and for removing that
example from WF 2.0
More information about the whatwg