[whatwg] HTML 5 : Misconceptions Documented

On 8/11/08, Kristof Zelechovski <giecrilj at stegny.2a.pl> wrote:

Hi Chris,

Thanks for taking the time to respond to some things I was writing
about. I think these are important things that deserve attention, too.

If it's not too much to ask, have you considered inline style response?
http://en.wikipedia.org/wiki/Posting_style#Inline_replying

I tried to restore posting order, but since you are using Outlook, it
was not effectively possible.

> 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")',

Can you cite a reference for this?

AFAIK, this is an IE feature that was copied.

> which is a shorthand notation for
>  'form.elements.item("$name")'.

No, that is wrong. Doubly wrong, I think. The item method retrieves a
node by ordinal index (based on depth-first traversal).

 now if you had wrote:-

form.elements.namedItem("$name")

That would at least be partially correct. If namedItem is what you
meant, then please supply a reference to back up your claim. I do not
think the claim:

| The correct way to address the control is 'form.elements("$name")'

is true and correct. I think it's an MSIE invention that other
implementations copied.

> 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).

Are you referring to the example I supplied?

>  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

There was no element in my example with a id or name 'ell', so I would
have to say that form.elements.ell would be undefined, not null.

Where is this - ell - coming from?

>  OTOH, the expression 'form.length' is a perfect equivalent for
>  'form.elements("length")', provided a control with such a name is contained.

form.elements has a readonly property named length.

That property can't be changed (legally) just because a parse  event
found an element named (or id'd) "length".

The length property of a form - form.length - refers to:

>  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, I have stated at least twice prior to this email that an
HTMLCollection has a readonly length property.

http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-75708506
| length of type unsigned long, readonly
| This attribute specifies the length or size of the list.

Garrett

>
>  Chris
>
>  -----Original Message-----
>  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.
>

>
>  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 13:37:24 UTC