Book Image

Mastering jQuery

By : Alex Libby
Book Image

Mastering jQuery

By: Alex Libby

Overview of this book

<p>Mastering jQuery has been written not only to help maximize your skills with core functionality in the library, but also to explore some of the more intriguing ways of using the library to achieve real-world solutions that could feature on any website or online environment.</p> <p>You'll start with a look at some of the more advanced ways to incorporate the library into your pages, followed by working with forms and advanced form validation using regular expressions. Next you'll move on to animating in jQuery, advanced event handling, and using jQuery effects.</p> <p>Finally, you will develop practical examples of using jQuery with external functionality such as node-webkit, before finishing with a session on optimizing your version of the library for maximum efficiency and exploring best practices for using QUnit.</p>
Table of Contents (21 chapters)
Mastering jQuery
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Exploring the use of patterns within the jQuery library


Now, you're probably thinking: I'm still not sure how these patterns relate to my work. Right?

Thought so. Throughout this chapter, we've spent time examining some of the more commonly used patterns, as a means of going back to basics; after all, the secret of improving oneself is not just through writing code!

The key point here is that if you spend time developing with jQuery, then you are already using design patterns; to help reinforce what you learned, let's take a look at a few examples from within the jQuery library itself:

Note

For the purposes of this demo, I've used jQuery 2.1.1; if you use a different version, then you may find that some of the line numbers have changed.

  1. Start by opening up a copy of jquery.js within a text editor of your choice—we'll begin with the classic document.ready() function, which uses the Façade pattern and is run from this function at or around line 3375, as shown in the following screenshot:

  2. How many...