2 ms·
To be fair, if attachEvent exists and is not a functions then some deep shit must be going on. In the first case you at least get an error to tell you about it.
by ufo 15y ago
To be fair, if attachEvent exists and is not a functions then some deep shit must be going on. In the first case you at least get an error to tell you about it.
But in general I prefer to use `'prop' in obj` instead of testing `obj.prop` for undefined. Some methods in IE browser objects have funky getters that sometime throw exceptions if you try to read them so using `in` is safer.