- Shopping Bag ( 0 items )
Ships from: Auburn, WA
Usually ships in 1-2 business days
Ships from: Pueblo West, CO
Usually ships in 1-2 business days
• Web application developers attempting to enhance the usability of their web sites and web applications
WHAT'S IN THIS CHAPTER?
A SHORT HISTORY
As the Web gained popularity, a gradual demand for client-side scripting languages developed. At the time, most Internet users were connecting over a 28.8 kbps modem even though web pages were growing in size and complexity. Adding to users' pain was the large number of round-trips to the server required for simple form validation. Imagine filling out a form, clicking the Submit button, waiting 30 seconds for processing, and then being met with a message indicating that you forgot to complete a required field. Netscape, at that time on the cutting edge of technological innovation, began seriously considering the development of a client-side scripting language to handle simple processing.
* The Core (ECMAScript)
* The Document Object Model (DOM)
* The Browser Object Model (BOM)
What exactly does ECMA-262 specify if it doesn't reference web browsers? On a very basic level, it describes the following parts of the language:
* Reserved words
The second edition of ECMA-262 was largely editorial. The standard was updated to get into strict agreement with ISO/IEC-16262 and didn't feature any additions, changes, or omissions. ECMAScript implementations typically don't use the second edition as a measure of conformance.
The third edition of ECMA-262 was the first real update to the standard. It provided updates to string handling, the definition of errors, and numeric outputs. It also added support for regular expressions, new control statements, try-catch exception handling, and small changes to better prepare the standard for internationalization. To many, this marked the arrival of ECMAScript as a true programming language.
ECMAScript 3.1 became ECMA-262, fifth edition, and was officially published on December 3, 2009. The fifth edition sought to clarify perceived ambiguities of the third edition and introduce additional functionality. The new functionality includes a native JSON object for parsing and serializing JSON data, methods for inheritance and advanced property definition, and the inclusion of a new strict mode that slightly augments how ECMAScript engines interpret and execute code.
What Does ECMAScript Conformance Mean?
ECMA-262 lays out the definition of ECMAScript conformance. To be considered an implementation of ECMAScript, an implementation must do the following:
* Support all "types, values, objects, properties, functions, and program syntax and semantics" (ECMA-262, p. 1) as they are described in ECMA-262.
* Support the Unicode character standard.
Additionally, a conforming implementation may do the following:
* Add "additional types, values, objects, properties, and functions" that are not specified in ECMA-262. ECMA-262 describes these additions as primarily new objects or new properties of objects not given in the specification.
* Support "program and regular expression syntax" that is not defined in ECMA-262 (meaning that the built-in regular-expression support is allowed to be altered and extended).
These criteria give implementation developers a great amount of power and flexibility for developing new languages based on ECMAScript, which partly accounts for its popularity.
ECMAScript Support in Web Browsers
By 2008, the five major web browsers (Internet Explorer, Firefox, Safari, Chrome, and Opera) all complied with the third edition of ECMA-262. Internet Explorer 8 was the first to start implementing the fifth edition of ECMA-262 specification and delivered complete support in Internet Explorer 9. Firefox 4 soon followed suit. The following table lists ECMAScript support in the most popular web browsers.
The Document Object Model (DOM)
The Document Object Model (DOM) is an application programming interface (API) for XML that was extended for use in HTML. The DOM maps out an entire page as a hierarchy of nodes. Each part of an HTML or XML page is a type of a node containing different kinds of data. Consider the following HTML page:
This code can be diagrammed into a hierarchy of nodes using the DOM (see Figure 1-2).
By creating a tree to represent a document, the DOM allows developers an unprecedented level of control over its content and structure. Nodes can be removed, added, replaced, and modified easily by using the DOM API.
Why the DOM Is Necessary
With Internet Explorer 4 and Netscape Navigator 4 each supporting different forms of Dynamic HTML (DHTML), developers for the first time could alter the appearance and content of a web page without reloading it. This represented a tremendous step forward in web technology but also a huge problem. Netscape and Microsoft went separate ways in developing DHTML, thus ending the period when developers could write a single HTML page that could be accessed by any web browser.
It was decided that something had to be done to preserve the cross-platform nature of the Web. The fear was that if someone didn't rein in Netscape and Microsoft, the Web would develop into two distinct factions that were exclusive to targeted browsers. It was then that the World Wide Web Consortium (W3C), the body charged with creating standards for web communication, began working on the DOM.
DOM Level 1 became a W3C recommendation in October 1998. It consisted of two modules: the DOM Core, which provided a way to map the structure of an XML-based document to allow for easy access to and manipulation of any part of a document, and the DOM HTML, which extended the DOM Core by adding HTML-specific objects and methods.
Whereas the goal of DOM Level 1 was to map out the structure of a document, the aims of DOM Level 2 were much broader. This extension of the original DOM added support for mouse and user-interface events (long supported by DHTML), ranges, traversals (methods to iterate over a DOM document), and support for Cascading Style Sheets (CSS) through object interfaces. The original DOM Core introduced in Level 1 was also extended to include support for XML namespaces. DOM Level 2 introduced the following new modules of the DOM to deal with new types of interfaces:
* DOM Views—Describes interfaces to keep track of the various views of a document (the document before and after CSS styling, for example)
* DOM Events—Describes interfaces for events and event handling
* DOM Style—Describes interfaces to deal with CSS-based styling of elements
* DOM Traversal and Range—Describes interfaces to traverse and manipulate a document tree
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.
|Ch. 2||ECMAScript basics||11|
|Ch. 3||Object basics||67|
|Ch. 6||DOM basics||159|
|Ch. 7||Regular expressions||193|
|Ch. 8||Browser and operating system detection||225|
|Ch. 9||All about events||261|
|Ch. 10||Advanced DOM techniques||303|
|Ch. 11||Forms and data integrity||335|
|Ch. 12||Sorting tables||367|
|Ch. 13||Drag and drop||387|
|Ch. 14||Error handling||411|
|Ch. 16||Client-server communication||481|
|Ch. 17||Web services||509|
|Ch. 18||Interacting with plugins||531|
|Ch. 19||Deployment issues||563|
Posted February 6, 2009
No text was provided for this review.