On Oct 18, 6:01 am, buda 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 = Object.clone(a);
dis
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 pr
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;
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
https://g
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 i
On Oct 18, 10:29 am, buda 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 = [];
>
> function initi
On Oct 18, 8:30 am, buda 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)); // "name"
Y
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 appr
T.J. what the reasons not to make them Object.prtototype methods?
On 18 окт, 14:21, "T.J. Crowder" wrote:
> On Oct 18, 8:30 am, buda wrote:
>
> > I try
>
> > var o = {};
> > o.name = 'propertyName';
> > alert(o.keys); --> undefined
>
> > why? but in debugger I see that Object has all methods, bu
I use destroy method on the class and clean everythig in it
On 18 окт, 14:17, "T.J. Crowder" wrote:
> On Oct 18, 10:29 am, buda 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
On Oct 18, 3:08 pm, buda 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 a.foo);
// -> "f
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
12 matches
Mail list logo