Re: Array.prototype[0] setter

2011-10-24 Thread Andrea Giammarchi
however, push does invoke [[Put]] but only in non array objects. var a = {}; Object.defineProperty( a, "0", { get : function() { alert('get 0'); return this.zero; }, set : function(v) { alert('set 0 ' + v); this.zero = v; }, enumerable : true, configurable : false }); a.length

Re: Array.prototype[0] setter

2011-10-24 Thread Andrea Giammarchi
In webkit nightly not even the getter gets invoked. On Tue, Oct 18, 2011 at 9:31 PM, felix wrote: > If I define a setter for Array.prototype[0], does [].push invoke that > setter? > > Test code: > > > > Object.defineProperty( >Array.prototype, 0, >{ get : function() { alert('get 0');

Re: Array.prototype[0] setter

2011-10-22 Thread David Bruant
Are there tests for this? David Le 18/10/2011 21:37, Allen Wirfs-Brock a écrit : > On Oct 18, 2011, at 12:31 PM, felix wrote: > >> If I define a setter for Array.prototype[0], does [].push invoke that setter? > It's supposed to. > >> Test code: >> >> >> >> Object.defineProperty( >>Array.pr

Re: Array.prototype[0] setter

2011-10-18 Thread Allen Wirfs-Brock
On Oct 18, 2011, at 12:31 PM, felix wrote: > If I define a setter for Array.prototype[0], does [].push invoke that setter? It's supposed to. > > Test code: > > > > Object.defineProperty( >Array.prototype, 0, >{ get : function() { alert('get 0'); return this.zero; }, > set : fu

Array.prototype[0] setter

2011-10-18 Thread felix
If I define a setter for Array.prototype[0], does [].push invoke that setter? Test code: Object.defineProperty( Array.prototype, 0, { get : function() { alert('get 0'); return this.zero; }, set : function(v) { alert('set 0 ' + v); this.zero = v; }, enumerable : true,