mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 15:23:29 -05:00
fe6ffb0ed5
* All UA detection moved into a separate file.
29 lines
739 B
JavaScript
29 lines
739 B
JavaScript
/* Copyright © 2011-2012 by Neil Jenkins. Licensed under the MIT license. */
|
|
|
|
/*global navigator, window */
|
|
|
|
var UA = (function ( win ) {
|
|
|
|
"use strict";
|
|
|
|
var ua = navigator.userAgent;
|
|
var isOpera = !!win.opera;
|
|
var isIE = /Trident\//.test( ua );
|
|
var isWebKit = /WebKit\//.test( ua );
|
|
|
|
return {
|
|
// Browser sniffing. Unfortunately necessary.
|
|
isOpera: isOpera,
|
|
isIE8: ( win.ie === 8 ),
|
|
isIE: isIE,
|
|
isGecko: /Gecko\//.test( ua ),
|
|
isWebKit: isWebKit,
|
|
isIOS: /iP(?:ad|hone|od)/.test( ua ),
|
|
|
|
// Browser quirks
|
|
useTextFixer: isIE || isOpera,
|
|
cantFocusEmptyTextNodes: isIE || isWebKit,
|
|
losesSelectionOnBlur: isIE
|
|
};
|
|
|
|
})( window );
|