Clarified the use of jQuery.browser and enforced jQuery.browser.firefox matching Firefox, after the discussion in 17791c9a3e.

This commit is contained in:
John Resig 2009-12-09 15:07:16 -08:00
parent 3ec2f1aef6
commit 9d8bd161b6

View file

@ -621,19 +621,18 @@ jQuery.extend({
}, },
// Use of jQuery.browser is frowned upon. // Use of jQuery.browser is frowned upon.
// It's included for backwards compatibility and plugins, // More details: http://docs.jquery.com/Utilities/jQuery.browser
// although they should work to migrate away.
browser: { browser: {
version: (/.*?(?:firefox|safari|opera|msie)[\/ ]([\d.]+)/.exec(userAgent) || [0,'0'])[1], version: (/.*?(?:firefox|safari|opera|msie)[\/ ]([\d.]+)/.exec(userAgent) || [0,'0'])[1],
safari: /safari/.test( userAgent ), safari: /safari/.test( userAgent ),
opera: /opera/.test( userAgent ), opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
firefox: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ) firefox: /firefox/.test( userAgent )
} }
}); });
// Deprecated // Deprecated
jQuery.browser.mozilla = jQuery.browser.firefox; jQuery.browser.mozilla = /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent );
if ( indexOf ) { if ( indexOf ) {
jQuery.inArray = function( elem, array ) { jQuery.inArray = function( elem, array ) {