`Prototype.Browser.Opera` now uses stronger inference and is determined by [[Class]] of `window.opera` being - "Opera". (kangax)
This commit is contained in:
parent
cc0a75fe19
commit
c44a071a3f
|
@ -1,3 +1,5 @@
|
|||
* `Prototype.Browser.Opera` now uses stronger inference and is determined by [[Class]] of `window.opera` being - "Opera". (kangax)
|
||||
|
||||
* Fix error in event.js which prevented attaching more than one responder for an event name/element combination. [#651 state:resolved] (Rob Lineweaver)
|
||||
|
||||
* Do not sniff when testing for IE's proprietary mouseenter/mouseleave events support. Use more robust inference instead. (kangax)
|
||||
|
|
|
@ -9,15 +9,19 @@
|
|||
var Prototype = {
|
||||
Version: '<%= PROTOTYPE_VERSION %>',
|
||||
|
||||
Browser: {
|
||||
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,
|
||||
MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
|
||||
},
|
||||
Browser: (function(){
|
||||
var ua = navigator.userAgent;
|
||||
// Opera (at least) 8.x+ has "Opera" as a [[Class]] of `window.opera`
|
||||
// This is a safer inference than plain boolean type conversion of `window.opera`
|
||||
var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
|
||||
return {
|
||||
IE: !!window.attachEvent && !isOpera,
|
||||
Opera: isOpera,
|
||||
WebKit: ua.indexOf('AppleWebKit/') > -1,
|
||||
Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1,
|
||||
MobileSafari: /Apple.*Mobile.*Safari/.test(ua)
|
||||
}
|
||||
})(),
|
||||
|
||||
BrowserFeatures: {
|
||||
XPath: !!document.evaluate,
|
||||
|
|
|
@ -25,7 +25,7 @@ new Test.Unit.Runner({
|
|||
this.assert(Prototype.Browser.WebKit);
|
||||
}
|
||||
|
||||
if(!!window.opera) {
|
||||
if(Object.prototype.toString.call(window.opera) === '[object Opera]') {
|
||||
this.info('Running on Opera');
|
||||
this.assert(Prototype.Browser.Opera);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue