JavaScript-for-Web-Developers

Book notes for Professional JavaScript for Web Developers, 4th Edition By Matt Frisbie

View project on GitHub

Chapter 1. What is JavaScript?

A Brief History of JavaScript

Introduced in 1995, Javascript’s main purpose was to provide basic client side scripting for form validation. Roundtrips to the server are time consuming and they were even more so in the era of telephone modems.

The story of LiveScript being renamed JavaScript to “capitalize on the buzz that Java was receiving” after being created by Brendan Eich for Netscape Navigator 2 is the absurdity of marketing made manifest.

After briefly covering Microsoft’s JScript implementation and the beginning of the browser wars, we arrive at ECMAScript.

“ECMAScript is simply a description of a language implementing all of the faces described in the specification. Javascript implements ECMAScript, but so does Adobe ActionScript.”

The history of ECMAScript versions was very interesting. ES6 / ES2015 has recently been the golden standard by which everyone’s legacy / not legacy codebase is judged, but I didn’t realize the 5th edition was actually ECMAScript 3.1, a compromise away from the radical 4th edition that was rejected for being “too big of a jump for the language”

The DOM

“The Document Object Model is an application programming interface (API) for XML that was extended for use in HTML. This tree structure allows for cross browser compatibility and was officially codified by the World Wide Web Consortium (W3C).

Originally the DOM structure was broken out into 3 levels. Level 1 was HTML as it is commonly known. It mapped “out the structure of a document”. Level 2 had a much “broader” aim. Mouse and user-interface events were introduced as well as CSS, and new modules of the DOM. Views, events, styles, and traversal and range all fall under DOM level 2. Level 3 provided more uniform functionality for document manipulation and form validation. “Presently, the W3C no longer maintains the DOM as a set of levels, but rather as the DOM living Standard”.

Various browsers support the different “levels” with varying degrees of fidelity but Level 1 is universally support and many of the functions of Level 2 and Level 3 have become safely cross browser.