Who says you can do too?
Good good. But seriously, βwho says?β Because it basically comes down to that.
In the beginning, Netscape Navigator 2, the first web browser that supports Javascript, appeared, and, indeed, a few months before being used on the server in Netscape Enterprise Server, the first thing you need to support Javascript (the so-called "Livescript" in beta, but quickly renamed to "Javascript" because it was in 1995, and the word "java" in everything was a sure way to get about 20,000 columns from technical journalists who spent the rest of their time thinking about the confusion around coffee, the wholesalers wondered where there were press releases and publicity swag).
The object model at that time was quite small, to such an extent that you could study it to such an extent that in a couple of days you could hold the whole model in your head. For most of the elements, you really couldn't handle them. A lot was quite complicated (where today you can find the current value <select id="selId" name="selName">
with document.getElementById('selId').value
and several other ways, then you will need document.forms[0]["selName"].options[document.forms[0]["selName"].selectedIndex].value
.
Then IE3 came out with Javascript too, NN 3 raised the ante, allowing you to change the src
attribute. Browser wars began in earnest. Many veterans still haunt memories of what they did.
The really obvious way to make the browser document model better was to have more and more things reflected by properties - preferably writable, not just readable. The following is the best that was, it was a little simpler and easier to remember the way to change something than another browser (then they could make more web pages that worked in the latest version of your browser, and not in your rival).
Due to the fast pace of development, it was clear that Netscape would develop a new middleware platform that would make Microsoft and Apple irrelevant, while the jury was independent of whether yahoo or alta-vista had a search approach and / or directory that will dominate the Internet. (Do not make long-term predictions regarding technology).
During the general trend of make-script -able-to-do-everything-to-everything, many properties got the name after the corresponding attribute when it was one, which in the end is pretty reasonable.
This is a bit inconsistent. First, most properties that match attributes map string values ββto string values ββin a straightforward way. One or two not, like the href
attribute for anchor elements, which gives you a richer object with properties that reflect parts of the URI (mainly because it was available from the first days until make-script -able-to- do-all-in- everything). This is useful (if you want to violate URIs) and nuisance, because there is no good way to say what exactly.
In the midst of this, they had something called DHTML, and something like dHTML, which were two ways to do almost the same thing in a completely incompatible way.
There is also the fact that javascript is free, allowing you to add a new property to anything, and HTML allows you to add new attributes (debatable, depending on how strictly you stay on which standard, but these were browser wars and new patented attributes, seemingly added by one browser or again every 4 minutes). To know if any property was a real effect for any given browser was unpleasant.
Meanwhile, in the distant International Consortium of Standards, something called XML was being developed. This allows you to add all kinds of elements with all attributes in various ways. Ways to solve this problem in the script have also been added.
We needed a way to change the attributes of the elements more consistently than the current ones, and since it was obvious that all future versions of HTML would be XML applications (do not make long-term predictions about the technology), it makes sense that it be at least relatively consistent between them.
Everyone also felt that having a more popular browser than everyone else would not turn anyone into the next Bill Gates (not even the current Bill Gates), so the benefits of more support for standard approaches than brighter stuff-another-guy-can't -do has become more apparent.
The W3C DOM was becoming more and more complete and more maintained. This gave us a more consistent way of setting attributes. It was more verbose, but you could know exactly what it was going to do, and it was also more powerful in creating, copying, editing, and deleting parts of a document.
But old sites should have been continued, if possible, as well as the fact that it remains a useful shorthand for many attributes, just to set the appropriate property so that people donβt stop using it. However, the DOM approach is supported to some extent by all browsers, providing much more consistency between them.
And then half of the developers started using jQuery anyway.