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
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');
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
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
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,
5 matches
Mail list logo