Re: [caplet] ADsafe
- On 11/04/2008, David-Sarah Hopwood <david.hopwood@...> wrote:
>The two are identical. From ES262 S11.2.1
> Mark Miller wrote:
> > On Sun, Apr 6, 2008 at 12:54 PM, Mike Samuel <mikesamuel@...> wrote:
> >> On 05/04/2008, Mark Miller <erights@...> wrote:
> >> > On Sat, Apr 5, 2008 at 8:02 AM, Douglas Crockford <douglas@...>
> >> wrote:
> >> > > [...] or string literals that are not legal identifiers.
> >> and "-Infinity"
> > I purposely left that out because it would already be covered by
> > Crock's "not legal identifiers" rule.
> IIUC, foo['-Infinity'] would be, but foo[-Infinity] wouldn't.
CallExpression [ <identifier-string> ]
where <identifier-string> is a string literal containing the same sequence of characters as the Identifier.
The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Expression.
4. Call GetValue(Result(3)).
5. Call ToObject(Result(2)).
6. Call ToString(Result(4)).
7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6).
Since step 6 converts the key to a string before it is used as a property name (defined in S8.7), there is no difference between foo[-Infinity] and foo['-Infinity'] as long as evaluating the reference 'Infinity' yields the value Infinity without side-effect.
- I updated the ADsafe DOM interface. Previously, a method like .getValue() could return
a single value
an array of values
depending on the number of results. Now, a method like .getValue() will return the first value that is available, or undefined if there are none. A new method, .getValues() will always return an array, possibly an empty array.