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

On Thu, Jul 10, 2008 at 12:22 AM, Cameron McCormack <cam@mcc.id.au> wrote:
>
> Cameron McCormack:
>> > > That's different from what I currently have in the Bindings spec,
>> > > which is basically "do a ToUint32() on the property name, and if the
>> > > result is a non-negative integer, use the index getter, otherwise use
>> > > the name getter".
>
> Simon Pieters:
>> > Hmm, seems like ToUint32 converts things like NaN and Infinity to 0.

When used in property access, the Expression is converted to a string
value. NaN and +Infinity will be a "NaN" and "Infinity" respectively.

Try it:

(function() {
    var a = [];
    a.NaN = 12;
    a.Infinity = 13;
    a[0] = "z";
    alert(a[NaN]);
    alert(a[1/0]);

// no property named "0x0" - so undefined;
    alert(a["0x0"]);

// -0.0 => 0, resolve the "0" property on a.
    alert(a[-0.0]);
})()


>> > Browsers don't do that. So I don't think that's good enough... e.g., we
>> > want ["0x0"], [1/0], etc., to use the name getter.
>

A string value of the Expression will be used. If the Expression is
"0x0", then the property "0x0" (or undefined) will be returned.

[snip]

Garrett

> --
> Cameron McCormack ≝ http://mcc.id.au/

Received on Thursday, 10 July 2008 17:16:44 UTC