[Prototype-core] Re: Assigning an unique ID

2007-07-14 Thread Sam Stephenson
On Jul 14, 2007, at 1:32 PM, Tobie Langel wrote: > I'm failing to see what advantage it has over directly storing a > reference to the element like so: > > this.myElement = $(e); > ... > var e = this.myElement; I'm using a similar technique in a couple of applications where I needed to cache

[Prototype-core] Re: Assigning an unique ID

2007-07-14 Thread Tobie Langel
Hi, I'm failing to see what advantage it has over directly storing a reference to the element like so: this.myElement = $(e); ... var e = this.myElement; Regards, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google G

[Prototype-core] Re: Event.observe will destroy the scope of Javascript OOP?

2007-07-14 Thread Радослав Станков
function Cat(){ this.color = "yellow"; } Cat.prototype.showColor = function(){ alert(this.color) } Cat.prototype.init(){ Event.observe("button", "click", this.showColor.bind(this)); } Will work just fine :) the problem is that when you assign action to a button the scope of the fun

[Prototype-core] Re: Assigning an unique ID

2007-07-14 Thread Ken Snyder
Jeff Watkins wrote: > ... > Element.Methods.assignId = function(element) { > element= $(element); > if (!element.id) > element.id= "uniqeId_" + (arguments.callee._nextUniqueId++); > return element.id; > } > Element.Methods.assignId._nextUniqueId=0; > ... +1 for such an addition. It is especially u