You are previewing Professional: JavaScript® for Web Developers, Third Edition.

Professional: JavaScript® for Web Developers, Third Edition

  1. Cover
  2. Contents
  3. Introduction
  4. Chapter 1: What is Javascript?
    1. A Short History
    2. JavaScript Implementations
    3. JavaScript Versions
    4. Summary
  5. Chapter 2: Javascript in Html
    1. The <script> Element
    2. Inline Code versus External Files
    3. Document Modes
    4. The <noscript> Element
    5. Summary
  6. Chapter 3: Language Basics
    1. Syntax
    2. Keywords and Reserved Words
    3. Variables
    4. Data Types
    5. Operators
    6. Statements
    7. Functions
    8. Summary
  7. Chapter 4: Variables, Scope, and Memory
    1. Primitive and Reference Values
    2. Execution Context and Scope
    3. Garbage Collection
    4. Summary
  8. Chapter 5: Reference Types
    1. The Object Type
    2. The Array Type
    3. The Date Type
    4. The RegExp Type
    5. The Function Type
    6. Primitive Wrapper Types
    7. Singleton Built-in Objects
    8. Summary
  9. Chapter 6: Object-Oriented Programming
    1. Understanding Objects
    2. Object Creation
    3. Inheritance
    4. Summary
  10. Chapter 7: Function Expressions
    1. Recursion
    2. Closures
    3. Mimicking Block Scope
    4. Private Variables
    5. Summary
  11. Chapter 8: The Browser Object Model
    1. The window Object
    2. The location Object
    3. The Navigator Object
    4. The screen Object
    5. The history Object
    6. Summary
  12. Chapter 9: Client Detection
    1. Capability Detection
    2. Quirks Detection
    3. User-Agent Detection
    4. Summary
  13. Chapter 10: The Document Object Model
    1. Hierarchy of Nodes
    2. Working with the DOM
    3. Summary
  14. Chapter 11: Dom Extensions
    1. Selectors API
    2. Element Traversal
    3. HTML5
    4. Proprietary Extensions
    5. Summary
  15. Chapter 12: Dom Levels 2 and 3
    1. DOM Changes
    2. Styles
    3. Traversals
    4. Ranges
    5. Summary
  16. Chapter 13: Events
    1. Event Flow
    2. Event Handlers
    3. The Event Object
    4. Event Types
    5. Memory and Performance
    6. Simulating Events
    7. Summary
  17. Chapter 14: Scripting Forms
    1. Form Basics
    2. Scripting Text Boxes
    3. Scripting Select Boxes
    4. Form Serialization
    5. Rich Text Editing
    6. Summary
  18. Chapter 15: Graphics With Canvas
    1. Basic Usage
    2. The 2D Context
    3. WebGL
    4. Summary
  19. Chapter 16: Html5 Scripting
    1. Cross-Document Messaging
    2. Native Drag and Drop
    3. Media Elements
    4. History State Management
    5. Summary
  20. Chapter 17: Error Handling and Debugging
    1. Browser Error Reporting
    2. Error Handling
    3. Debugging Techniques
    4. Common Internet Explorer Errors
    5. Summary
  21. Chapter 18: Xml in Javascript
    1. XML DOM Support in Browsers
    2. XPath Support in Browsers
    3. XSLT Support in Browsers
    4. Summary
  22. Chapter 19: Ecmascript For Xml
    1. E4X Types
    2. General Usage
    3. Other Changes
    4. Enabling Full E4X
    5. Summary
  23. Chapter 20: JSON
    1. Syntax
    2. Parsing and Serialization
    3. Summary
  24. Chapter 21: Ajax and Comet
    1. The XMLHttpRequest Object
    2. XMLHttpRequest Level 2
    3. Progress Events
    4. Cross-Origin Resource Sharing
    5. Alternate Cross-Domain Techniques
    6. Security
    7. Summary
  25. Chapter 22: Advanced Techniques
    1. Advanced Functions
    2. Tamper-Proof Objects
    3. Advanced Timers
    4. Custom Events
    5. Drag and Drop
    6. Summary
  26. Chapter 23: Offline Applications and Client-Side Storage
    1. Offline Detection
    2. Application Cache
    3. Data Storage
    4. Summary
  27. Chapter 24: Best Practices
    1. Maintainability
    2. Performance
    3. Deployment
    4. Summary
  28. Chapter 25: Emerging APIS
    1. RequestAnimationFrame()
    2. Page Visibility API
    3. Geolocation API
    4. File API
    5. Web Timing
    6. Web Workers
    7. Summary
  29. Appendix A: Ecmascript Harmony
  30. Appendix B: Strict Mode
  31. Appendix C: Javascript Libraries
  32. Appendix D: Javascript TOOLS
O'Reilly logo

Chapter 12

DOM Levels 2 and 3

WHAT’S IN THIS CHAPTER?

  • Changes to the DOM introduced in Levels 2 and 3
  • The DOM API for manipulating styles
  • Working with DOM traversal and ranges

The first level of the DOM focuses on defining the underlying structure of HTML and XML documents. DOM Levels 2 and 3 build on this structure to introduce more interactivity and support for more advanced XML features. As a result, DOM Levels 2 and 3 actually consist of several modules that, although related, describe very specific subsets of the DOM. These modules are as follows:

  • DOM Core — Builds on the Level 1 core, adding methods and properties to nodes.
  • DOM Views — Defines different views for a document based on stylistic information.
  • DOM Events — Explains how to tie interactivity to DOM documents using events.
  • DOM Style — Defines how to programmatically access and change CSS styling information.
  • DOM Traversal and Range — Introduces new interfaces for traversing a DOM document and selecting specific parts of it.
  • DOM HTML — Builds on the Level 1 HTML, adding properties, methods, and new interfaces.

This chapter explores each of these modules except for DOM events, which are covered fully in Chapter 13.

image

DOM Level 3 also contains the XPath module and the Load and Save module. These are discussed in Chapter 18.

DOM CHANGES

The purpose of the DOM Levels 2 and 3 Core is to expand the DOM API to encompass ...

The best content for your career. Discover unlimited learning on demand for around $1/day.