- From: Kristof Zelechovski <giecrilj@stegny.2a.pl>
- Date: Mon, 11 Aug 2008 21:54:05 +0200
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. Chris -----Original Message----- From: whatwg-bounces@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 name/id. <form><input name="length"></form> document.forms[0].elements.length Opera9: [object HTMLInputElement] <-- BUG FF3: 1 Saf3: 1 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 http://www.whatwg.org/specs/web-forms/current-work/#select-check-default >
Received on Monday, 11 August 2008 12:54:05 UTC