[jquery-dev] Re: Bug in 1.4rc1 $.extend

2010-01-17 Thread Tyron
Well, I've got your point, and changed my code to var data = jQuery.extend(true, [], arrComp); With that, I wanted to make a copy of "arrComp" into "data", so that deleting something in data won's mess with arrComp, right? Testing like you did (and even if I make arrComp.toSource() , copy the cont

[jquery-dev] Re: Bug in 1.4rc1 $.extend

2010-01-13 Thread Dave Methvin
> x[1] = {twist: 3}; > alert( x.toSource() ); // [{test:1}, {twist:3}] My test case was broken! When I change it to this: var x = [ {test:1}, {toast:2} ]; var y = $.extend(true, [], x); x[1].toast = 3; alert( y.toSource() ); I get the expected output: [{test:1}, {toast:2}] That is, x was deep-

[jquery-dev] Re: Bug in 1.4rc1 $.extend

2010-01-13 Thread Dave Methvin
> var data = jQuery.extend(true, {}, arrComp); You're extending an Array into an empty Object? That would lose the Array-ness of the original object. I don't think this is a use case that was ever anticipated, not sure it makes sense. You could extend into an empty array [] to fix that, but after