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
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access