javascript Operators in
@March 15, 2008, 1:22 a.m.
in | Firefox/Netscape/NN 6 IE 5.5(Win) ECMA n/a |
|
|
The in operator lets scripts quickly uncover whether an object has a particular property or method implemented for it. The left operand is a string containing the name of the property or method (method name without parentheses), while the right operand is a reference to the object. If your exploration requires DOM references entailing "dots," put them in the object reference side of the expression. In other words, instead of trying "style.filter" in document.body, use "filter" in document.body.style. Were it not that so few browsers implement this future ECMA operator, it would be a useful tool in object detection. |
|
Example | |
if ("createDocument" in document.implementation) { // go ahead and use document.implementation.createDocument( ) } |
Permanent URL:
http://javascript.gakaa.com/operators-in.aspx
Powered by Linode.