i want to use the mootools library to do animation & ajax in a widget i’m building.
i plan to have the widget write itself into the page so the end user just deploys a single line of javascript.
i’m concerned about the compatibility issues that may arise if my widget is used on a page which is already using another library.
short tests show problems even when enclosed in a self executing function if scriptaculous is already loaded, although jquery doesn’t seem to cause a problem.
what is the best solution to this?
is there any way to load mootools in isolation so i can just use it for my purposes?
i see that jquery, whilst unfamiliar to me, is highly namespaced and therefore probably more appropriate to the task, would using that instead alleviate any potential problems?
can i just copy and paste mootools into my self executing function?
nb: the following error when using with prototype comes as a result of using mootool’s setStyle method.
element.style is undefined
element.style.cssText += ';' + styles;
There isn’t a method to use mootools. The developers have specifically stated that they are not going to namespace mootools to run along side prototype and they squash any attempts to have the core changed to do it (see 1).
You really are just better off using either jQuery or another namespaced library (I believe both Dojo and YUI are, but I could be mistaken), or if you don’t need the overhead, just build your own in good old-fashion JS.