Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery framework internals

I am trying to understand the internals of how jquery framework is written and finding it hard to understand the code.

Does anyone have any suggestions regarding a good way to get started.

Thanks for all the useful input. Editing the topic since I had limited space for adding individual comments. I have written a lot of basic javascript code. I know basic DOM, have used event handlers, know CSS basics. I have read about many of the topics you have mentioned and I am familiar with it although not an expert and have not coded some of the advanced topics like closures. Here are the books I have used so far Head first javascript - good in the beginning as a starter. Books my friends have recommended and I use regularly are Javascript - The Definitive Guide, Javascript - The good parts (I read this a while ago and it was hard for me at the time). My friend just recommended Secrets of Javascript Ninja - John Resig. Seems like a good one. I ordered the Javascript Design patterns book you recommend last week

I have read the https://developer.mozilla.org/en/JavaScript you pointed me to. I will checkout some of the other resources you pointed me to.

Let me think a little more regarding if I want to do a little more reading before I post specific questions I have on jquery.

Thanks Susan

like image 652
Susan Avatar asked Sep 14 '09 04:09

Susan


People also ask

Is jQuery still used in 2022?

jQuery is still used in countless projects ranging from enterprise e-commerce apps to simple landing pages. Secondly, jQuery is still good for certain things, such as rapid prototyping and even animation, if you aren't good with CSS. jQuery may be outdated, but jQuery is not dead.

Is jQuery a framework?

jQuery is a JavaScript framework. It facilitates the readability and the manipulation of HTML DOM elements, event handling, animations, and AJAX calls. It's also free, open-source software that adheres to the MIT License. As a result, it is one of the most popular JavaScript libraries.

What does $() mean in jQuery?

In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery. A (selector) to "query (or find)" HTML elements.

Is jQuery an API?

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.


2 Answers

To comprehend the actual source would require some degree of Javascript knowledge - If you don't already know what's going on then you basically need to learn more Javascript.

Key things to learn:

  • Prototypal inheritance ( the inheritance used in ECMAScript, the core language on which Javascript is based upon )
  • Lambdas ( inline functions )
  • Closures ( outer variables from outer scope accessible from inner functions )
  • Regular expressions ( used for matching the selector strings fed to jQuery )
  • DOM ( The DOM API which is used to interact with markup languages )

When learning, use Firebug so you can evaluate your expressions interactively and immediately see what's going on

An excellent free resource for learning that I would recommend: http://eloquentjavascript.net/contents.html

If you're a beginner to DOM Scripting/Javascript:

  • http://www.amazon.com/DOM-Scripting-Design-JavaScript-Document/dp/1590595335/ref=sr_1_19?ie=UTF8&s=books&qid=1252905196&sr=1-19

If you're intermediate level:

  • http://www.amazon.com/gp/product/0596517742/ref=s9_simz_gw_s0_p14_i3?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0KCJ77GKHPREBFD3WAKG&pf_rd_t=101&pf_rd_p=470938631&pf_rd_i=507846

If you're past intermediate level and want to be an expert:

  • http://www.amazon.com/Professional-JavaScript-Developers-Wrox-Guides/dp/0764579088
  • http://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273/ref=sr_1_10?ie=UTF8&s=books&qid=1252905139&sr=1-10
  • http://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X/ref=sr_1_16?ie=UTF8&s=books&qid=1252905196&sr=1-16

Other technical references:

  • http://www.w3.org/DOM/
  • http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf
  • https://developer.mozilla.org/en/JavaScript

If you have specific questions about a certain code snippet just ask here. Another resource that I can recommend for more advanced questions would be the jQuery mailing list or irc://irc.freenode.net/jquery where jresig hangs out himself and comes by and answers questions. There are other guru ops who reside there like ajpiano/paulirish/nlogax.

like image 188
meder omuraliev Avatar answered Oct 26 '22 00:10

meder omuraliev


If you're looking for insight about how jQuery is written, the uncompressed source code is pretty readable. There are a few books mentioned in SO74884 that are worth a read. Resig's book doesn't really cover jQuery at all, but is good about teaching object oriented javascript.

If you are having a problem understanding something in jQuery's code (why it was done/how it works), you should post a question with some code bits to Stack Overflow, asking for some help understanding it.

like image 38
gnarf Avatar answered Oct 25 '22 23:10

gnarf