I recently read a tutorial on CSS browser feature detection... The end product was something like this...
var prefix = [\'Moz\', \'webkit\', \'O\', \'ms\', \'Kht
if (foo in bar)
is used to check whether the value named foo
is a property of the object bar
. Since arrays are just specially treated objects, you are correct in assuming that it can be used to check for a value in an array.
test_style = document.createElement('div').style
returns an object with properties; since this is the case, you can use the foo in bar
syntax to check it.