O'Reilly logo

Professional XMPP Programming with JavaScript® and jQuery by Jack Moffitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required