Re: A problem with an apparently common JS menu...
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: A problem with an apparently common JS menu...

From: Lasse Reichstein Nielsen <lrn@hotpop.com>
Date: Wed Nov 16 2005 - 00:59:39 CET

Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:

> In contrast to `document.getElementById', `document.all' is not a
> reference to an Function object, so it is inappropriate to refer
> to its members by using the Call Operator (`()').

Since the only official specification of document.all is the MSDN
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/collections/all.asp>
and it uses function call as the access method, I don't think you
can say that it isn't. It's untraditional to use function objects
for collections, but not illegal in any way.

> While the IE DOM allows both document.all[...] and document.all(...)
> to refer to members of this collection, this is certainly not
> standards compliant behavior

It can't be, since there is no standard. The document.all
functionality is very much a de-facto standard of "doing like IE
does".

> and therefore error-prone (MS may recognize this bug and remove it
> in future IE versions with you having to deal with the
> consequences):

Unlikely. At times I wish they would forget about backwards
compatability and do things right instead, but it's not the way they
work.

> the same property cannot be both non-function and function.

Then it's a function (i.e., an object with a [[Call]] method).
Functions are objects, so it's not impossible to have properties
that work with the property access operator at the same time.

/L

-- 
Lasse Reichstein Nielsen  -  lrn@hotpop.com
 DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
  'Faith without judgement merely degrades the spirit divine.'
Received on Mon Nov 21 03:30:51 2005