I am wondering if it is a good idea to rely on frameworks like jQuery or MooTools or should we just use plain JavaScript?
Apart from avoiding the re-invention of wheel, do they add any specific value?
Since the frameworks are open to the public, can there be possibility of exploitation of any security holes that might appear (of course, unintentionally :) ) in the frameworks?
Are there any other points that are to be considered when choosing a framework or otherwise?
Frameworks solve cross-browser bugs which normally would cost hours of your time, so you can focus on functionality instead of worrying about some edge case browser bug.. instead of wasting 4-5 hours solving a bug spend that time with your family.
Frameworks such as jQuery are pretty loaded with stuff like animation, selectors, html manipulation so there's usually some sort of functionality already built into the library, again saving you more time and the API makes it really easy to actually accomplish complex things.
Interpreters and browsers are only getting faster and faster so I don't particularly think it's a huge issue loading an entire library up. In addition thanks to Google et al we get very fast cdns and nowadays lots of sites are using the same exact URI to pull the script in, meaning there's a higher rate of the script getting cached and reused on another site.
Instead of every single web developer having their own library it's much more efficient having thousands of people concentrated to bettering a handful of libraries so cross-browser bugs get documented and fixed.
Competition is a good thing, the result of the slickspeed tests resulted in much faster selector engines such as Sizzle. Developers not having to worry about trivial DOM bugs means more complex libraries are created daily, which means entry-level developers have access to very powerful plugins.
As far as security, jQuery for example will detect if the browser is capable of parsing JSON natively and if so, rely on that. Usually any modern browser will have this, and it's much safer than eval
... so jQuery strives to use the safer and more secure methods first. It will only use eval if there isnt a JSON.parse method available.
An important thing to remember in jQuery though is remembering you're still coding in Javascript. Usually people get too caught up in the sugar coated methods and wrapping everything in $
, I think it's important to know you can still do this.href
instead of $(this).attr('href')
if you would like an absolutely normalized uri for example.