Take a case, I want to use multiple javascript libraries into one page like jquery, mootools, scriptalous.
Is it a good idea? Should I do ths?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the library. Libraries such as YUI, or jQuery use a strict system of namespaces that means that they can run happily together. E.g. The Module Pattern http://www.yuiblog.com/blog/2007/06/12/module-pattern/
However libraries that use a prototypal model, such as MooTools, or Prototype are much more complex. They use prototypal inheritance to modify native objects, such as Array, Number and String.
While this offers some very elegant solutions, and enables the library developers to “fix” some of the inherent problems with JavaScript, it does mean that they rarely play nicely together.
Also as the libraries may seem to run perfectly until a particular native is used in some obscure way, you can get intermittent, and very tricky to solve, bugs.