jQuery is by far the most popular JavaScript library. jQuery makes it easy to
traverse HTML documents, handle events, build animations, and perform Ajax interactions.
In this section we review how jQuery uses Idioms, Modern Patterns, and Classic Patterns.
We will also look at extending jQuery through plugins.
jQuery Modern Patterns & Idioms | |
---|---|
Introduction | Introduction to jQuery and Design Patterns |
Module | Organizes the code in logical or functional units |
Single var | Declares and initializes all function variables with a single var |
Double Exclamation | Apply double exclamation to a variable to ensure it is boolean |
Overloading | Allows function overloading using argument switching |
Placeholder | A way to signify unused function parameters |
Short Walk | Shortens the length of the prototype chain walk |
Options Hash | Reduces multiple function arguments to a single argument |
Chaining | Allows multiple chained method calls on an object |
Namespace | Organizes the code to avoid name collisions |
Lazy Load | Creates data or code items only when absolutely necessary |
Zero Timeout | Provides a way to avoid the user iterface from freezing up |
jQuery Classic Patterns | |
---|---|
Singleton | An object of which only a single instance can be created |
Iterator | Sequentially access the elements of a collection |
Observer | A way of notify changes to a number of objects |
Proxy | An object representing another object |
Facade | A single object that represents an entire subsystem |
Adapter | Matches interfaces of different objects |
jQuery Plugin Patterns | |
---|---|
jQuery Plugins | An effective way to extend or enhance jQuery |