Permalink
9 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Simplification of uaMatch, based upon the patch by Ben Alman.
- Loading branch information
Showing
1 changed file
with
6 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would this be a good time to use window.opera.version() instead of the regexp ?
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see a particularly huge reason either way - the regexp works and only has to be run once (and it would certainly make the resulting logic a bit more complicated, since everything else would be using a regexp).
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a more stable solution, as Opera has changed their UA string once already, nothing is stopping them from changing it in the future. Using the API the browser provides will ensure it will work in the future.
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, to that end, we could use document.documentMode to actually test whether IE8 is operating in IE7 mode or not :)
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cowboy: oops, why I have not thought of this before ?! Very simple and effective.
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opera.version() is the only vendor-provided method for testing browser version that's been in a shipping product for >3 releases. So I wouldn't say this is a good time to move to feature inference via documentMode.
For me, I think testing against opera.version would be sensible. While there is no rush, I think the largest reason to do it is because others take inspiration from jQuery's broweser detection. And as opera has provided this functionality specifically for this reason (and people who used it didnt face a problem during the opera 10 as 9.8 snafu.....) I think it's wise.
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paul: I do not understand ? Are you saying that document.documentMode can be removed from IE9? Are you (also) saying that this has something to do with (not)using window.opera.version() ? Also: what is "snafu" ?
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DBJDBJ: http://github.com/jquery/jquery/commit/7be5ec1248c749ece648c8d80a71b45320556381 <-- I think this is what paul is referring to when he mentions the Opera 9.8 "snafu".
09ef5b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the snafu I was referring to: http://dev.opera.com/articles/view/opera-ua-string-changes/
documentMode
did not exist in IE6 and if IE decides to not introduces a triple rendering engine browser with IE9 (please God, no), then it might not be there. It's not a reliable property to base a version inference off of.