Use different tactic to sniff for Opera in order to avoid false positives in IE. [#176 state:resolved]

This commit is contained in:
Andrew Dupont 2008-07-17 15:22:18 -05:00 committed by Tobie Langel
parent 7444a4ad02
commit 5ddfad8a62
3 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,5 @@
* Use different tactic to sniff for Opera in order to avoid false positives in IE. [Tobie Langel, jddalton]
* Rename variable in Form.Element.Serializers.select. (jddalton)
* Coerce Opera's version string into a number whenever we need to sniff. (Sam Holman, jddalton)

View File

@ -457,7 +457,7 @@ Element.Methods = {
element.style.position = 'relative';
// Opera returns the offset relative to the positioning context, when an
// element is position relative but top and left have not been defined
if (window.opera) {
if (Prototype.Browser.Opera) {
element.style.top = 0;
element.style.left = 0;
}

8
src/prototype.js vendored
View File

@ -4,10 +4,12 @@ var Prototype = {
Version: '<%= PROTOTYPE_VERSION %>',
Browser: {
IE: !!(window.attachEvent && !window.opera),
Opera: !!window.opera,
IE: !!(window.attachEvent &&
navigator.userAgent.indexOf('Opera') === -1),
Opera: navigator.userAgent.indexOf('Opera') > -1,
WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
Gecko: navigator.userAgent.indexOf('Gecko') > -1 &&
navigator.userAgent.indexOf('KHTML') === -1,
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
},