Appendix A. Getting Started with jQuery
For years JavaScript programmers have been dealing with the myriad idiosyncrasies of the DOM (Document Object Model) API. Many people created helper functions that abstracted particular operations so that they worked across all browsers, and a few of the best abstractions became polished enough to become generally useful for a wide range of applications. The jQuery library is a lightweight, cross-browser JavaScript library that replaces the ugly parts of the DOM API with a clever CSS selector-based API that makes quick work of most tasks.
jQuery is excellent for slicing and dicing HTML, but it also works very well on XML documents. Because XMPP stanzas are just XML document fragments, jQuery makes manipulating XMPP much easier than using the raw DOM APIs.
Strophe itself was partially inspired by the function chaining, use of callbacks, and plug-in architecture in jQuery, and so the two libraries fit together quite naturally.
If you haven't used or seen jQuery before, this appendix teaches you the basics and gives you the background you need to use jQuery effectively for your own XMPP applications. The jQuery library also provides many other useful functions for web programming, like AJAX requests and animations, but these are not covered here because they are not used in the book.
FINDING JQUERY
You can find the jQuery library on the Web at http://jquery.com. jQuery's web site also contains tutorials, reference documentation, examples, and a long ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access