Reputation: 331
If I have three forms in a html page
<form name="sss">a</form>
<form name="sss">b</form>
<form name="sss">c</form>
When I try to to access the document.sss It returns back a really wired array look as follows
[form, form, form, sss: form]
This array has three form a b c and a property named ss with value pointing to the first form defined with name "sss". However, if you put a
<div name="sss">d</form>
Into the dom, it is not put into the array.
I don't understand why browser do this because we can access forms through other way. It is really confusing to put those forms into a document object. And even if browser want you to have a easy way to refer those forms, why the returned array has a wired property "sss" pointing to the first form named "sss".
Upvotes: 1
Views: 49
Reputation: 943981
Because in the 1990s, browser vendors didn't cooperate. They threw features in without a great deal of consideration for the big picture desperately trying to win market share by giving developers shiny things to play with.
Now we are stuck with browsers wanting to be backwards compatible with websites designed back then (or written by people with skills from that era).
Upvotes: 1