Understanding the nature, history, and limitations of JavaScript is essential in order to be fluent in an interview and code at work.
- The origin of JavaScript
- DOM
- Browser wars
- Setting standards
The origin of JavaScript
JavaScript was developed by Netscape in partnership with Sun. Before the advent of JavaScript, when web surfing became more and more popular, the Internet could no longer meet the larger and more complex interaction needs of users, and the demand for developing client-side scripts gradually increased.
Netscape, then at the forefront of technological innovation, began to seriously consider developing a client-side scripting language to solve simple processing problems. Just before the official release of Netscape Navigator 2.0, Netscape changed its name to JavaScript in order to capitalize on the Internet buzzword Java. Netscape’s gamble paid off, and JavaScript has since become an essential component of the Internet.
The first version of JavaScript, JavaScript version 1.0, appeared in Netscape Navigator 2, released in 1995.
Second, the DOM
DOM is the Document Object Model. Simply put, DOM is a set of methods for abstracting and conceptualizing the content of a document; It defines a standard way to access and manipulate HTML documents, expressing them as a tree structure, as shown below:
3. Browser wars
Netscape Navigation 4 was released in June 1997 and IE 4 was released in October of that year. Both browsers have made a number of improvements to their earlier versions, greatly expanding the DOM and increasing the amount of functionality that can be done with JavaScript.
Unfortunately, NN 4 and IE 4 use two incompatible DOM versions.
Netscape’s DOM uses proprietary elements called layers. The layer has a unique ID, such as:
document.layers['myelement']
In the Microsoft DOM this element must be applied like this:
document.all['myelement']
This leads to the ridiculous situation where programmers actually have to write many scripts twice. As a result, DHTML went from being a hot topic to something people didn’t want to talk about.
Microsoft beat Netscape in the browser market share war because Internet Explorer came pre-installed on all PCS running Windows.
Fourth, develop standards
While browser makers were using the DOM as a marketing weapon, the W3C quietly rolled out a standardised DOM that incorporated everyone’s strengths. Thankfully, Netscape, Microsoft, and other browser makers were able to put aside their animosity and work with the W3C on a new standard, which was DOM Level 1 in October 1998
The W3C defines the DOM as “a platform – and language-independent interface through which programs and scripts can dynamically access and modify the content, structure, and style of documents.” The W3C’s standardized DOM is far more independent and applicable than the proprietary DOM of various browser manufacturers
References:
- W3school online tutorials
- JavaScript DOM Programming Art (2nd Edition)