I will play with this over the weekend.. let's close this thread :)
thanks for the insights.


On Nov 26, 8:23 pm, Aaron Newton <[email protected]> wrote:
> you can always do this:
>
> $(myUL).addEvent("click:realy(li)", function(event, element) {
>   if (element.retrieve('isFolder', false)) this.addFolder(element);
>
> });
> On Thu, Nov 26, 2009 at 4:04 AM, Rolf -nl <[email protected]> wrote:
> > :) I see the benefits.
> > All I'm saying or better: asking myself, is that I then need css
> > classes for the delegation element selection.
> > For whatever reason I try to avoid dependancy of css classes for
> > application logic..
>
> > this:
>
> > if(element.retrieve('isFolder', false)) this.addFolder(element);
>
> > to me looks cleaner than:
>
> > if(element.hasClass('folder')) this.addFolder(element);
>
> > or maybe it's just me ;)
>
> > in the end I will implement delegation probably, because of the
> > benefits.
>
> > On Nov 25, 10:24 pm, Aaron Newton <[email protected]> wrote:
> > > > If I would re-write part of the classes taking advantage of event
> > > > delegation I would have create html first so that I can use css
> > > > classes to filter out the elements needed that should receive the
> > > > proper events for mousedown/mouseup/dblclick, etc. Correct? The css
> > > > classes are required for filtering.
>
> > > If you describe all your behavior with delegation, your code is
> > simplified
> > > when you need to add elements. You just parse your json into element
> > objects
> > > and inject them in the document. All the event delegation logic is
> > > written/applied once, when you attach to the container.

Reply via email to