inuyaksa/jquery.nicescroll — Issue #2: IE Sniffing
Author: mkmcdonald
Created: 2011-11-09 17:26:29+00:00
State: open

`this.isie = (document.all && !document.opera);` is an utterly hideous sniff.

Not only does `document.opera` not exist in Opera, but your current sniff will return the `document.all` HTMLCollection if it exists. I don't think you realize how costly that is. That's every single element node in the DOM. On a large site, this is murder.

You're looking for `window.opera`. Even then, that's a proprietary property that could be removed at any time. It's fallacious to rely on it.

Thirdly, `(document.all && !document.opera)` will return `undefined` rather than a boolean if `document.all` or `document.opera` doesn't exist. You would want implicit boolean conversion via the `!!` technique or explicit conversion via the `Boolean` constructor.

Please do your homework on the DOM and realize that object inferences such as these are monumentally stupid.

Here's a start:

1. http://www.fortybelow.ca/hosted/comp-lang-javascript/faq/notes/detect-browser/
2. http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting