O'Reilly logo

Professional, JavaScript® for Web Developers, Second Edition by Nicholas C. Zakas

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

Chapter 21. Upcoming APIs

With the flurry of interest that Ajax brought back to web development also came a call to restart the browser evolution. As part of this movement, a number of new APIs began to take shape. Some were based on things that browsers had already implemented, some on ideas of how to fix things that were broken, and some were born out of developer demand. The result was a number of specifications describing ways to extend JavaScript in the browser so that it becomes more compatible with how developers are using it.

Note

The APIs covered in this chapter are, at the time of this writing, still under development and may change significantly before being finalized. These changes may include renaming, addition, and removal of methods and/or properties. The following is intended solely to indicate the direction that JavaScript is going.

The Selectors API

One of the most popular capabilities of JavaScript libraries is the ability to retrieve a number of DOM elements matching a pattern specified using CSS selectors. Indeed, the library jQuery (www.jquery.com) is built completely around the CSS selector queries of a DOM document in order to retrieve references to elements instead of using getElementById() and getElementsByTagName().

The Selectors API (www.w3.org/TR/selectors-api) was started by the W3C to specify native support for CSS queries in browsers. All JavaScript libraries implementing this feature had to do so by writing a rudimentary CSS parser and then use existing ...

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