diff options
author | Rick Waldron <waldron.rick@gmail.com> | 2012-06-25 10:02:28 -0400 |
---|---|---|
committer | Rick Waldron <waldron.rick@gmail.com> | 2012-06-25 10:02:28 -0400 |
commit | a2758377df7eef02d155a30f869bdc3d8b7c02b9 (patch) | |
tree | 659eefc1136c5523219b7640d8848461f74ed058 /src/deprecated.js | |
parent | b47147118c8f291e7db34b377706b6f48ac45b3e (diff) | |
download | jquery-a2758377df7eef02d155a30f869bdc3d8b7c02b9.tar.gz jquery-a2758377df7eef02d155a30f869bdc3d8b7c02b9.zip |
Adds src/deprecated.js, test/unit/deprecated.js; -deprecated flag; Moves jQuery.browser and removes use in test/unit/ajax.js. Fixes #11965
Diffstat (limited to 'src/deprecated.js')
-rw-r--r-- | src/deprecated.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/deprecated.js b/src/deprecated.js new file mode 100644 index 000000000..04bf5bad0 --- /dev/null +++ b/src/deprecated.js @@ -0,0 +1,41 @@ +// Limit scope pollution from any deprecated API +(function() { + +var matched, browser; + +// Use of jQuery.browser is frowned upon. +// More details: http://api.jquery.com/jQuery.browser +// jQuery.uaMatch maintained for back-compat +jQuery.uaMatch = function( ua ) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || + /(webkit)[ \/]([\w.]+)/.exec( ua ) || + /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || + /(msie) ([\w.]+)/.exec( ua ) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; +}; + +matched = jQuery.uaMatch( navigator.userAgent ); +browser = {}; + +if ( matched.browser ) { + browser[ matched.browser ] = true; + browser.version = matched.version; +} + +// Deprecated, use jQuery.browser.webkit instead +// Maintained for back-compat only +if ( browser.webkit ) { + browser.safari = true; +} + +jQuery.browser = browser; + +})(); |