Javascript Reference
Categories: document

javascript document expando

@March 15, 2008, 1:22 a.m.
expando Firefox/Netscape/NN n/a IE 4 Chrome/Safari/DOM n/a

Read/Write

Specifies whether scripts in the current document allow the creation and use of custom properties assigned to the document object. The extensible nature of JavaScript allows scripters to create a new object property by just assigning a value to it (as in document.stooge = "Curly"). This also means the document accepts incorrectly spelled property assignments, such as forgetting to set a middle letter of a long property name to uppercase (marginLeftColor). Such assignments are accepted without question, but the desired result is nowhere to be seen. If you don't intend to create custom properties, consider setting document.expando to false in an opening script statement as you author a page. This could help prevent spelling errors from causing bugs. The setting affects only scripts in the current document.

 
Example
 
document.expando = false;
 
Value

Boolean value: true | false.

 
Default

true


Powered by Linode.