0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00
Squire/source/UA.js
Neil Jenkins fe6ffb0ed5 Add IE10 compatibility.
* All UA detection moved into a separate file.
2012-11-12 18:30:40 +11:00

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 );