On Feb 8, 2007, at 9:49 AM, Sam Sherlock wrote: > AFAIK prototype require more code than jquery
maybe().onlyBecause().jQueryLikesTo().stringEverything().alongLikeThis (); The gain is that you may write less code, but the drawback is that it is harder to read. > and is generally not unobtrusive, I may be wrong about this Prototype has some really nice Event libraries that keep things unobtrusive. http://prototypejs.org/api/event > as you attach events to elements via classname or ids > foreinstance. I have a jLink class which I use to change the > content of a page. Below is the jQuery code that attaches the > binds the code to anchors with > > // jLink - now add events > $("a.jLink").click(function(event) { > event.stopPropagation (); > event.preventDefault(); > > jLinkCall(this.href); > }); > > // ### Begin jLink Events ### > > function jLinkCall(jHref) > { > > // extract the id from this.href > var htmlDoc = new String(jHref); > > // CODE TO PROCESS THE HREF {WHATEVER YOU NEED TO DO} > ... > > // SLIDE UP THE MAIN DIV > $("div#main").slideUp("fast").empty(); > > // REQUEST JSON CONTENT > $.getJSON("/articles/data/" + htmlDoc,params,function(json) { > // debug in firebug > console.debug(json); > ); > } // END jLinkCall() Something similar in prototype might look like: //The first registers the second event registration at window.onload; Event.observe(window, 'load', function() { Event.observe('jLink', 'click', jLinkCall); }); function jLinkCall(event) { //get a reference to the originating element var elem = Event.element(event); //do stuff with JSON or effects or whatever.... Event.stop(); } -- John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---