Name
expando — NN n/a IE 4 DOM n/a
Synopsis
Read/Write
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 merely by 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
Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.