diff --git a/CHANGELOG b/CHANGELOG index 2b0dbcc..dcf3fca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/src/dom.js b/src/dom.js index 07ef2d6..89e17ee 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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; } diff --git a/src/prototype.js b/src/prototype.js index d0a874c..2b0655e 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -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/) },