Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Zoe Xiao
Zoe Xiao
7,195 Points

Does jQuery make DOM scripting useless?

I am reading the book DOM scripting and I wonder if DOM scripting like getElementByTagName is outdated as jQuery provides a simpler way to get any element in the web page?

1 Answer

Pure Javascript to access the DOM can be faster as you can cut the overhead that jQuery has on this. However it doesn't always have to be faster as you could write some major mistakes that slow things down again. jQuery on the other hand has been battle tested over the past few years and is proven to be performant.

Another thing is, jQuery wasn't specifically designed with mobile devices in mind. Events like click cause a delay due to this fact (~300ms). jQuerys animations are also quite slow on the average mobile device because the way they are written makes them CPU bound, an average mobile device doesn't have a lot of CPU power. A way around this is by using hardware accelerated CSS animations.