|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Gecko object key interpretation specific: a bug or a feature?Having a statement such as:
var obj = { foo: 'bar', default: 'default_value' } Firefox 3.5.3 creates obj with properties foo and default. IE reports syntax error "Expected identifier, string or number", same or similar syntax error occurs on Safari, Chrome and Opera. By placing default into quotes we are making the code valid for all browsers in question: var obj = { foo: 'bar', 'default': 'default_value' } My question is if it is a Gecko bug, a convenience extension or the proper implementation by ECMA with others being wrong on that? _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
Re: Gecko object key interpretation specific: a bug or a feature?On 24 Oct 2009, at 20:20, VK wrote: > Having a statement such as: > > var obj = { > foo: 'bar', > default: 'default_value' > } > > Firefox 3.5.3 creates obj with properties foo and default. > > IE reports syntax error "Expected identifier, string or number", same > or similar syntax error occurs on Safari, Chrome and Opera. By placing > default into quotes we are making the code valid for all browsers in > question: > > var obj = { > foo: 'bar', > 'default': 'default_value' > } > > My question is if it is a Gecko bug, a convenience extension or the > proper implementation by ECMA with others being wrong on that? This is a spidermonkey 'bug' in the default is in the list of future reserved words by the ES262 (ECMAScript 3) spec. Wether its actually a problem or not is another matter of course. _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
|
|
|
|
|
Re: Gecko object key interpretation specific: a bug or a feature?VK wrote:
> > > Having a statement such as: > > > > var obj = { > > > foo: 'bar', > > > default: 'default_value' > > > } > > > > Firefox 3.5.3 creates obj with properties foo and default. > > > > IE reports syntax error "Expected identifier, string or number", same > > > or similar syntax error occurs on Safari, Chrome and Opera. By placing > > > default into quotes we are making the code valid for all browsers in > > > question: > > > > var obj = { > > > foo: 'bar', > > > 'default': 'default_value' > > > } > > > > My question is if it is a Gecko bug, a convenience extension or the > > > proper implementation by ECMA with others being wrong on that? Brendan Eich wrote: > Not a bug, yes a convenience, and proper implementation of ES5 (after > ES3.1 and ES4, which both allowed reserved words to be used in > property-name contexts). Also a proper extension to ES3, which allows > such syntactic extensions (see chapter 16). > > IE has yet to ship the ES5 JScript implementation I've seen demo'ed at > Ecma TC39 meetings. Thank you for your clarification. _______________________________________________ dev-tech-js-engine mailing list dev-tech-js-engine@... https://lists.mozilla.org/listinfo/dev-tech-js-engine |
| Free embeddable forum powered by Nabble | Forum Help |