Chapter 6. jQuery utility functions
This chapter covers
- The jQuery browser detection flags
- Using other libraries with jQuery
- Functions for manipulating arrays
- Extending and merging objects
- Dynamically loading new script
Up to this point, we’ve spent a fair number of chapters examining jQuery commands—the term that we’ve applied to methods that operate upon a set of DOM elements wrapped by the $() function. But you may recall that way back in chapter 1, we also introduced the concept of utility functions—functions namespaced by $ that don’t operate on a wrapped set. These functions could be thought of as top-level functions except that they are defined on the $ instance rather than window.
Generally, these functions either operate upon JavaScript objects other than DOM elements (that’s the purview of the commands after all), or they perform some non-object-related operation.
You may wonder why we waited until this chapter to introduce these functions. Well, we had two primary reasons, which follow: