Have you tried Yahoo User Interface library? It is not just a library. It is a framework like Prototype. You can dynamically load just the modules you want (by specifying it in the "requires"); however I you may not even want to load an entire library.
On Thu, Apr 30, 2009 at 12:04 PM, Alex McAuley < [email protected]> wrote: > > Why would it not be that good .... Insert takes 2 arguments and 1 of those > arguments has 4 possibilities.... > > -> Following is prototypes version of it. and if you know that you are > always going to give it VALID HTML then you can strip alot of it out > insert: function(element, insertions) { > element = $(element); > > if (Object.isString(insertions) || Object.isNumber(insertions) || > Object.isElement(insertions) || (insertions && (insertions.toElement > || insertions.toHTML))) > insertions = {bottom:insertions}; > > var content, insert, tagName, childNodes; > > for (var position in insertions) { > content = insertions[position]; > position = position.toLowerCase(); > insert = Element._insertionTranslations[position]; > > if (content && content.toElement) content = content.toElement(); > if (Object.isElement(content)) { > insert(element, content); > continue; > } > > content = Object.toHTML(content); > > tagName = ((position == 'before' || position == 'after') > ? element.parentNode : element).tagName.toUpperCase(); > > childNodes = Element._getContentFromAnonymousElement(tagName, > content.stripScripts()); > > if (position == 'top' || position == 'after') childNodes.reverse(); > childNodes.each(insert.curry(element)); > > content.evalScripts.bind(content).defer(); > } > > return element; > }, > > > > > > ----- Original Message ----- > From: "Bertrand" <[email protected]> > To: "Prototype & script.aculo.us" < > [email protected]> > Sent: Thursday, April 30, 2009 4:54 PM > Subject: [Proto-Scripty] Re: Extracting methods from codebase > > > > Because there's a reason why Prototype, jQuery and the likes have such > success. It lies in the fact that the developers are very talented and > provide good code. Unfortunately, I'm kind of new to the whole > javascript scene and I don't know how to handle all the cross-browser > oddities, the corner cases, etc. > > So yeah sure I theoretically *could* code an update function. But now > would it be that good? Don't think so... > > Also why reinvent the wheel when there are libraries around? > > On Apr 30, 8:48 am, "Alex McAuley" <[email protected]> > wrote: > > why cant you code your own insert function.... its not that hard ... > > You can probably do it in about 15 lines or so.. > > > > Alex > > > > ----- Original Message ----- > > From: "Bertrand" <[email protected]> > > To: "Prototype & script.aculo.us" > > <[email protected]> > > Sent: Thursday, April 30, 2009 4:47 PM > > Subject: [Proto-Scripty] Re: Extracting methods from codebase > > > > Hi Walter, > > > > > There was a project getting started late last year called pulpjs that > > > was aiming at this problem. It's sort of a port of Prototype with the > > > following goals: no global namespace pollution, no extensions of > > > native prototypes, and everything is modular and non-dependent. Have a > > > look at their download builder for a hint of what I > > > mean:http://pulpjs.org/downloads/ > > > > This is exactly what I wanted. Unfortunately I trust Prototype's > > "namebrand" and the quality it provides me. I wish that Prototype > > developers will be headed that way in the future, that would > > definitely provide coders much-needed flexibility. Cause really it > > pains me to have to drop Prototype every time because I can't for the > > life of me get it trimmed down under 20kB. > > > > Thanks a lot for the link anyway. > > > > > Note that this is Prototype-like, but not a drop-in replacement. > > > > > Walter > > > > > On Apr 29, 2009, at 4:33 PM, Bertrand wrote: > > > > > > That would indeed be another interesting way of doing it. The only > > > > problem is that javascript is often used in environments where > > > > filesize is critical. In my case, I only use ONE function from the > > > > library, because I've found it to be th best way to achieve what I > > > > want to do: Element.update. > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
