W3C home > Mailing lists > Public > public-html@w3.org > July 2008

Re: HTMLCollection item() vs. namedItem() with [] syntax (detailed review of the DOM)

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 25 Jul 2008 21:32:11 -0700
Message-ID: <c9e12660807252132l690570a2oe2840019ce14fc5@mail.gmail.com>
To: public-html <public-html@w3.org>

On Fri, Jul 25, 2008 at 8:15 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> Hi Garrett.
> Garrett Smith:

>> Any assumption that there is a modified [[Get]] for the collection
>> would be wrong.
> I see.  If we want to specify that (that they are real properties that
> exist on the object),

Whatever you do, definitely do not document something as being other
than what it actually is in implementations.

> then I think it will be hard for Web IDL to
> provide some syntactic description of this behaviour.

Why are you trying to document EcmaScript [[Get]] in IDL? EcmaScript's
[[Get]] and property access operators are language specific to
EcmaScript, are clearly defined, and don't have the same meaning in
other bindings.

[[Get]] resolves a property on an object (up through the prototype
chain) and returns its value or undefined.

Identifier[ <property-name-string> ]


document.body.childNodes.0 - is not valid syntax, so the other
property access operators must be used.


> So it would then
> be up to HTML to state that properties get created and removed when
> elements are added and removed from the document.

That seems to be a mistake. It can be clearly demonstrated that at
least 3 implementations, Safari3, Firefox4, and Opera9 implement
property access of a collection in an XMLDocument.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<title>XML Document</title>
<script type="text/javascript">

Would it be bad to specify it in the EcmaScript bindings as an
optional feature, and just make a small note about it? e.g.
"Implementations MAY implement create numeric properties of the
collection which may be then accessed via property access operator, in
lieu of item()"


This would leave explaining [[Get]] to the relevant language
specification (Ecma-262)

It would probably be OK to omit the details of where on the prototype
chain these properties exists or what attributes they have (if the
items are ReadOnly, DontDelete, et c).


> --
> Cameron McCormack
Received on Saturday, 26 July 2008 04:32:47 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:34 UTC