Permalink
3 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
browser version detection revised for opera >= 10, which was reportin…
…g itself as 9.8 due to their new policy
- Loading branch information
Showing
1 changed file
with
2 additions
and
2 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
7be5ec1
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.
details on this 9.80 thing: http://dev.opera.com/articles/view/opera-ua-string-changes/
i went with this regex approach mostly for consistency..
the alternative is using
window.opera.version()
, which is supported in opera 7.6+, though we wouldnt have the useragent unit tests against it, obviously.7be5ec1
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.
So you went with the more brittle solution ?
Opera has proven that it doesn't mind changing the UA string so why rely on it when the alternative smaller/more reliable solution exists ?
Consistency can take a back seat here. A
toString
variable already exists in your primary closure so no need to use{}
.7be5ec1
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.
If I were using a RegExp, I'd do something more like..
} else if ( matches = /^(opera).*(?:version)?/(\d+.\d+)/.exec( ua ) ) {
ret = { browser: matches[1], version: matches[2] }
}