[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread T.J. Crowder
On Oct 18, 6:01 am, buda www...@pochta.ru wrote: here the code http://jsfiddle.net/QW8vM/10/ `Object.clone` returns a raw object with a shallow copy of the properties of the object you give it. It is not a perfect copy of the object down to the prototype level: var a, b; a = [1, 2, 3]; b =

[Proto-Scripty] Why created object is not extended with Object methods?

2011-10-18 Thread buda
I try var o = {}; o.name = 'propertyName'; alert(o.keys); -- undefined why? but in debugger I see that Object has all methods, but o - not! -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
it's general example for show the problem with Object.clone :) Usually I use anothe technique: var a = Class.create((function(){. var instancePrivates = []; function initialize(){ var internalId; instancePrivates.push({}); internalId = --instancePrivates;

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
in last example of course this.internalId = --instancePrivates; instead of var internalId; internalId = --instancePrivates; -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To view this discussion on the web visit

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
that sample was to demonstarte Object.clone bug :) Usually I us to var a = Class.create((function() { var _privates = []; function initialize() { _privates.push({}); this.internalId = _privates.length-1; _privates[this.internalId].items = []; -- here the instances

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread T.J. Crowder
On Oct 18, 10:29 am, buda www...@pochta.ru wrote: that sample was to demonstarte Object.clone bug :) It's not a bug, though I'd say detecting that it's being fed an array wouldn't be a bad feature to add. Usually I us to var a  = Class.create((function() {    var _privates = [];    

[Proto-Scripty] Re: Why created object is not extended with Object methods?

2011-10-18 Thread T.J. Crowder
On Oct 18, 8:30 am, buda www...@pochta.ru wrote: I try var o = {}; o.name = 'propertyName'; alert(o.keys); -- undefined why? but in debugger I see that Object has all methods, but o - not! `keys` is not an instance method, it's a method of the `Object` function: alert(Object.keys(o)); //

Re: [Proto-Scripty] Re: Adding CSS-Rules to a styletag in Prototype

2011-10-18 Thread Walter Lee Davis
On Oct 17, 2011, at 9:40 PM, joe t. wrote: i don't think Prototype has a method for directly editing a STYLE tag (only for modifying styles on element[s]. But http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript seems to offer a couple cross-browser

[Proto-Scripty] Re: Why created object is not extended with Object methods?

2011-10-18 Thread buda
T.J. what the reasons not to make them Object.prtototype methods? On 18 окт, 14:21, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 18, 8:30 am, buda www...@pochta.ru wrote: I try var o = {}; o.name = 'propertyName'; alert(o.keys); -- undefined why? but in debugger I see that

[Proto-Scripty] Re: strange problem with detect method and cloning data

2011-10-18 Thread buda
I use destroy method on the class and clean everythig in it On 18 окт, 14:17, T.J. Crowder t...@crowdersoftware.com wrote: On Oct 18, 10:29 am, buda www...@pochta.ru wrote: that sample was to demonstarte Object.clone bug :) It's not a bug, though I'd say detecting that it's being fed an

[Proto-Scripty] Re: Why created object is not extended with Object methods?

2011-10-18 Thread T.J. Crowder
On Oct 18, 3:08 pm, buda www...@pochta.ru wrote: T.J. what the reasons not to make them Object.prtototype methods? If you add something to `Object.prototype`, it shows up on *every* object. So for instance: Object.prototype.foo = function() { return bar; }; var a = {}; console.log(typeof

RE: [Proto-Scripty] Re: Why created object is not extended with Object methods?

2011-10-18 Thread wwwboy
thanks for the explanation! -Original Message- From: prototype-scriptaculous@googlegroups.com [mailto:prototype-scriptaculous@googlegroups.com] On Behalf Of T.J. Crowder Sent: Tuesday, October 18, 2011 6:52 PM To: Prototype script.aculo.us Subject: [Proto-Scripty] Re: Why created object