I have gotten very familiar with the core functionality of Javascript and now I am aiming at learning DOM manipulation. I have already thought of learning jQeury for this but I don't know if it is good idea to learning it before first getting familiar with the core functionality of the DOM.

Should I first learn the core functionality of the DOM and then learn jQuery? If so, why? Or should I just go on ahead and learn jQuery?

  • 4
    The DOM is more general, hence it seems more valuable to understand (long-term) – Caffeinated Mar 25 '12 at 20:55

Learn the DOM. By doing that, you will have a better understanding and appreciation for what libraries like jQuery do for you. This also means you'll be better suited in the long run if you must change tools. The DOM will always be there, and is common ground for understanding the fundamental design choices for any given library that interacts with the DOM.

With all that given, I don't think there is anything wrong with learning the DOM alongside jQuery. Especially if you have a project that requires JQuery and needs to get done relatively soon. I think the important thing is that you learn how the DOM works in order to keep yourself decoupled from any particular library.

  • 4
    There's plenty wrong with "learning the DOM alongside jQuery". The two are mutually exclusive. You either consult the magic $ or learn why hand code is better. Try following the source code in jQuery. It's a pile of spaghetti. – null Mar 25 '12 at 21:07
  • 1
    @Matt: I didn't mean to imply that two should be mixed arbitrarily. I meant that someone could, in order to learn, implement a feature using the DOM, and then re-implement it in jQuery. You don't have to look at source code in order to compare how their APIs differ. Especially since both have fairly good documentation. – Jeremy Mar 25 '12 at 22:56
  • You can learn a lot about JavaScript from that spaghetti. – Erik Reppen Jun 13 '13 at 5:21

jQuery depends on you knowing the DOM because that is what you are manipulating.
"There's not much point to jQuery without the DOM"

the DOM is just HTML and has no such dependency on jQuery.
"You can do plenty of static site work with just the DOM"

Of course there's edge cases and exceptions but for general learning purposes I would go by the above.

  • 6
    "DOM is just HTML" is a strange statement, "HTML is a serialized format of the DOM" would be a better statement – Raynos Mar 25 '12 at 23:02
  • @Michael, who are you quoting? I agree with the first one. The second one is inaccurate. Perhaps you could put some more thought into it then I might vote for this. – ScrollerBlaster Oct 13 '12 at 6:31

It depends.

  • Do you want to support IE6-8 ?
  • Do you have time/desire to learn browser quirks?

If you don't have the time/desire to learn how to fix IE6-8 by hand then using jQuery is not a bad option, note that jQuery is a mediocre solution for cross browser compliant code but it's a quick and dirty solution.

If you don't care about oldIE and have the time to learn the DOM then start reading about the DOM

In an ideal situation you don't need jQuery, your better off using the real DOM API and using polyfills for browser compliance.

Knowing and using the real DOM API increases readability/maintainability because all web developers know the DOM and only some know library X. It also significantly increases performance because abstractions like jQuery are an order of magnitude slower.

  • If one lacks the time/desire to learn about IE 6-8, then I'd seriously question their acumen as a "web developer". Shouldn't a driver know how to drive in adverse conditions? – null Mar 25 '12 at 21:09
  • 4
    @MattMcDonald your analogy sucks. Try "Shouldn't a driver know how to drive cars from the 40s" and the answer is "if you like antique cars, go for it". If you like legacy browsers, go for it – Raynos Mar 25 '12 at 22:11
  • 2
    JQuery improves development even if there are no browser bugs. – Daniel Little Mar 25 '12 at 22:56
  • 3
    @Lavinski You mean jQuery trolls all over your development with it's heavy performance penalty and horribly inconsistent and messy API? – Raynos Mar 25 '12 at 22:59
  • 1
    @user16764 on average when you look at performance differences its an order of magnitude. This benchmark says jQuery is two orders of magnitude slower (which is an outlier). It's personal experience of seeing hundreds of benchmark that's its roughly an order of magnitude slower. – Raynos Mar 26 '12 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.