document.all offers another IE quirk
Sunday, 4. September 2005, 17:04:06
The site uses the outdated document.all syntax.
document.all is the main collection of IE's original document object model. It contains all elements in the document, and you can access individual elements with normal JavaScript bracket notation: document.all[0] or document.all['someElementID'] .
It is less known that in addition to the normal bracket syntax one can also use round brackets - like in a function call. document.all(0) is equivalent to document.all[0]. I don't know why IE supports this, perhaps to cater for newbie JavaScript authors who don't distinguish properly between square and round brackets?
The Maltanet site uses the less familiar syntax document.all() with various arguments. Some of the arguments have the value null. It turns out that while document.all[null] is undefined (as one expects), document.all(null) returns the first element in the document!
Not suprisingly, this quirk evaded both FireFox and Opera when they implemented their document.all support. Hence the menus on this particular page will only work in IE.








hallvors # 6. September 2005, 14:34
I got to reading your miscoded journal from Scott Andrew LePera. I notice in the pages I have read that a couple times you wonder aloud why IE allows () where it should only allow [] in JavaScript. Beyond or complementing the 'embrace and extend' theory, I'm pretty confident it has something to do with making VB[Script] writers comfortable. VB, of course, is Microsoft's baby, and they seemed to hope to supplant JavaScript on web pages with VBScript. And VB uses () for indexing arrays and hashes as well as for calling functions.
qicai02 # 30. May 2006, 08:19
qicaispace # 7. July 2006, 14:38
xErath # 1. November 2006, 03:56
Then hide it