Internet Explorer 4.0 now supports what Microsoft have named 'expando' properties. Basically, this means that any attribute used in a known element can be manipulated through scripting. Also, within a script function, properties of referenced elements can be created, even if the attribute for the new property was never set. This is even taken a stage further, in that unknown elements can be used within a HTML document, setting attribute/property values which can be utilised in a script.
A good example of this has been used within the HTMLib. In each title (the non-scrolling region above this topic), the links that open the scripting and syntax windows use extra attributes of XSIZE
and YSIZE
, which are used to specify the size of the window that is opened to view the syntax, or scripting topic. For example:
<A href="expandos.htm" ID="SyntaxLink" ... XSIZE="375" YSIZE="390">Expando Syntax</A>
Within the HTMLib front-end, these properties are picked up when the link is activated and used to size the new window created. Within a HTML document:
SyntaxLink.xsize
would return the value given in the XSIZE
attribute, if VBScript was the scripting language for the element. JScript (Javascript) is case-sensitive, so the reference would have to be:
SyntaxLink.XSIZE
otherwise, a new expando property of the referenced element would be created, with the lowercase name (which could cause hard-to-find scripting bugs).
Note that for expando properties to be activated within a document, the document.expando
property must be set to true
. This is the default value.
As you can see, this brings almost unlimited attribute access through scripting, as now you're free to set up/manipulate any attribute/property value. Any unknown attributes set in an element are accessible as a property of the element.
© 1995-1998, Stephen Le Hunte