[whatwg] HTML 5 : Misconceptions Documented

Garrett Smith dhtmlkitchen at gmail.com
Tue Aug 5 23:48:52 PDT 2008


On Tue, Aug 5, 2008 at 4:02 PM, Thomas Broyer <t.broyer at gmail.com> wrote:
> On Tue, Aug 5, 2008 at 8:03 AM, Garrett Smith wrote:
>> On Mon, Aug 4, 2008 at 3:17 PM, Thomas Broyer wrote:
>>>
>>> Actually, there is:
>>> http://www.w3.org/TR/html5/dom.html#htmlcollection
>>> and I believe the "elements" property of HTMLFormElement is actually
>>> an HTMLFormControlsCollection:
>>> http://www.w3.org/TR/html5/dom.html#htmlformcontrolscollection
>>>
>>
>> First off, the IndexGetter behavior on the HTMLCollection[1] is the
>> authors imagination.
>
> Aren't "document.forms[0]" and "document.forms.myform" working?
>

Can you be more specific and direct in your reply? It isn't clear what
your point is.

>> The following example shows that indexed Properties exist on
>> NamedNodeMap, HTMLCollection, NodeList (just like they do on Arrays).
>> There is no [[ IndexGetter ]] as Cameron likes to make pretend.
>
> This is an "implementation detail" of the ECMAScript binding.
>

In EcmaScript, the property access operators seem to look like a
"getter" to Cameron. What they really do is provide access to
properties added to the collection, or, in one case (on one
implementation), this seems implemented as a "getter". A "getter" is a
method that gets the value of a property of that name.

Cameron McCormick is learning JavaScript and in the process, trying to
write a specification. That is dangerous. What is worse is that he is
displaying complete arrogance by refusing to discuss his obvious
mistakes based on what he and Simon imagine browsers are doing and
what they want browsers to do. That, I pointed out, and in a fairly
cordial manner here:
http://lists.w3.org/Archives/Public/public-html/2008Jul/0169.html

But unfortunately Cameron decided to make neither change nor
acknowledgment of this mistake of his (I will probably not have time
or energy to get around to discussing his other mistakes, which are
probably more serious and potentially harmful).

> In C#, these would obviously be mapped to indexers ("public
> HTMLElement this[int index] { get { ... } }" and "public object
> this[String name] { get { ... } }"), and there is no equivalent in
> Java.

What you are calling obvious is not clear to me.

What is clear is that there is a new specification that includes
something about indexed properties on collection objects. My example
made clear that that there is no "getter" for properties, except for
Form in Mozilla, and that is deprecated behavior from Netscape. A much
better alternative exists in browsers today. That behavior is the
properties added to a collection (ES bindings in browsers).

That part of the specification was based on either misunderstanding,
poor observation, or imagination. It has been documented vaguely,
making references to EcmaScript [[Get]], but is apparently supposed to
be used in other languages. Since the item() method is always
available, it is really unnecessary and can only serve to create real
problems by requiring the changing of Stable code.

Here is Cameron demonstrates his failed attempt to understand what the
browser is doing:

http://www.w3.org/TR/DOM-Bindings/#IndexGetter
| If the [IndexGetter]  extended attribute appears on an
| operation with a single unsigned long argument, it indicates
| that an object that implements the interface  can be indexed
| with an unsigned long,

Apparently it would mean something like:

// "operation"
childNodes[ 0 ];

I clearly nicely pointed out Cameron's misunderstanding to him, on this list;

With the methods item() and namedItem() and getNamedItem(), the
bindings in EcmaScript can provide property access to the property.
There is no [[IndexGetter]].

> I guess that in Python and Ruby, which share their "dynamic" nature
> with ECMAScript, these wouldn't be true properties as well

As well? As well as what? And what sort of 'guess'? This sounds like
the type of vague guessing that went into Cameron's wrote up.

>  (i.e. '0'
> in document.forms would be False, and document.forms["0"] wouldn't be
> equivalent to document.forms[0])
>

Why do you say this?

In EcmaScript, document.forms[0] is equivalent to document.forms['0'].
I'm not sure what you're thinking.

Property access calls ToString on the property name. What would be
"shared" with Python and Ruby?

This thread took a turn from the problems in WF 2.0, and the official
documentation of the misconceptions that are so common in a good
number of web devs. I'd like to get back to that next.


>
> --
> Thomas Broyer
>



More information about the whatwg mailing list