You will also learn about base2’s pioneering support for the W3C Selectors API that was recently natively implemented in Internet Explorer 8.0, Firefox 3.1, Safari 3.0, and Opera 10. base2 utilizes the native implementation when one is present for speed and efficiency and falls back on its own implementation when one is not present.
In addition, you will learn about a couple of methods from base2’s rich API set. base2 provides the indexOf() and lastIndexOf() methods for arrays, and provides several other useful enhancements to strings and arrays, such as the forEach() method, which makes enumeration less verbose.
Finally, base2 is even looking forward to the emerging HTML5 draft specification with support for the classList property and its methods, add(), remove(), toggle(), and has(), which let you easily manipulate the class names of elements in the DOM.
- Programming conventions and best practices
- Discusses how you can use base2 to repair and bridge standards support in browsers
- Describes how you can use the W3C's event API in all modern browsers, including Internet Explorer
- Also includes some discussion of base2's support for de facto standards, such as Mozilla's array extras, and the DOMContentLoaded event, which reduce the amount of code you need to write, in addition to making your scripts load more quickly.
Table of Contents
Section 1: Programming Conventions 2
XHTML and CSS Conventions 3
Summary of Section 1 20
Section 2: Bridging Incompatibilities with base2 21
Event Standards Provided by base2 22
Bridging the Event Compatibility Gap with base2 32
The DOMContentLoaded Event 35
Summary of Section 2 36
Section 3: Selectors — Not Just for CSS Anymore 37
Summary of Section 3 49
Section 4: Other Useful Features of base2 49
indexOf() and lastIndexOf() 50
The classList Property 61
Summary of Section 4 63
About Richard York 65
Usage Rights for Wiley Wrox Blox
Any Wrox Blox you purchase from this site will come with certain restrictions that allow Wiley to protect the copyrights of its products. After you purchase and download this title, you:
- Are entitled to three downloads
- Are entitled to make a backup copy of the file for your own use
- Are entitled to print the Wrox Blox for your own use
- Are entitled to make annotations and comments in the Wrox Blox file for your own use
- May not lend, sell or give the Wrox Blox to another user
- May not place the Wrox Blox file on a network or any file sharing service for use by anyone other than yourself or allow anyone other than yourself to access it
- May not copy the Wrox Blox file other than as allowed above
- May not copy, redistribute, or modify any portion of the Wrox Blox contents in any way without prior permission from Wiley
If you have any questions about these restrictions, you may contact Customer Care at (877) 762-2974 (8 a.m. - 5 p.m. EST, Monday - Friday). If you have any issues related to Technical Support, please contact us at 800-762-2974 (United States only) or 317-572-3994 (International) 8 a.m. - 8 p.m. EST, Monday - Friday).