0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

IE11 Compatibility

This commit is contained in:
Neil Jenkins 2013-10-08 15:00:38 +11:00
parent 5d30a85aa8
commit 0b3df54b6e
4 changed files with 13 additions and 13 deletions

View file

@ -27,16 +27,16 @@ var isIOS = /iP(?:ad|hone|od)/.test( ua );
var isMac = /Mac OS X/.test( ua ); var isMac = /Mac OS X/.test( ua );
var isGecko = /Gecko\//.test( ua ); var isGecko = /Gecko\//.test( ua );
var isIE = /Trident\//.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua );
var isIE8 = ( win.ie === 8 ); var isIE8 = ( win.ie === 8 );
var isOpera = !!win.opera; var isOpera = !!win.opera;
var isWebKit = /WebKit\//.test( ua ); var isWebKit = /WebKit\//.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-'; var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIE || isOpera; var useTextFixer = isIE8or9or10 || isOpera;
var cantFocusEmptyTextNodes = isIE || isWebKit; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit;
var losesSelectionOnBlur = isIE; var losesSelectionOnBlur = isIE8or9or10;
var hasBuggySplit = ( function () { var hasBuggySplit = ( function () {
var div = doc.createElement( 'div' ), var div = doc.createElement( 'div' ),
text = doc.createTextNode( '12' ); text = doc.createTextNode( '12' );
@ -1154,8 +1154,8 @@ function Squire ( doc ) {
// IE sometimes fires the beforepaste event twice; make sure it is not run // IE sometimes fires the beforepaste event twice; make sure it is not run
// again before our after paste function is called. // again before our after paste function is called.
this._awaitingPaste = false; this._awaitingPaste = false;
this.addEventListener( isIE ? 'beforecut' : 'cut', this._onCut ); this.addEventListener( isIE8or9or10 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIE ? 'beforepaste' : 'paste', this._onPaste ); this.addEventListener( isIE8or9or10 ? 'beforepaste' : 'paste', this._onPaste );
if ( isIE8 ) { if ( isIE8 ) {
this.addEventListener( 'keyup', this._ieSelAllClean ); this.addEventListener( 'keyup', this._ieSelAllClean );

File diff suppressed because one or more lines are too long

View file

@ -22,16 +22,16 @@ var isIOS = /iP(?:ad|hone|od)/.test( ua );
var isMac = /Mac OS X/.test( ua ); var isMac = /Mac OS X/.test( ua );
var isGecko = /Gecko\//.test( ua ); var isGecko = /Gecko\//.test( ua );
var isIE = /Trident\//.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua );
var isIE8 = ( win.ie === 8 ); var isIE8 = ( win.ie === 8 );
var isOpera = !!win.opera; var isOpera = !!win.opera;
var isWebKit = /WebKit\//.test( ua ); var isWebKit = /WebKit\//.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-'; var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIE || isOpera; var useTextFixer = isIE8or9or10 || isOpera;
var cantFocusEmptyTextNodes = isIE || isWebKit; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit;
var losesSelectionOnBlur = isIE; var losesSelectionOnBlur = isIE8or9or10;
var hasBuggySplit = ( function () { var hasBuggySplit = ( function () {
var div = doc.createElement( 'div' ), var div = doc.createElement( 'div' ),
text = doc.createTextNode( '12' ); text = doc.createTextNode( '12' );

View file

@ -107,8 +107,8 @@ function Squire ( doc ) {
// IE sometimes fires the beforepaste event twice; make sure it is not run // IE sometimes fires the beforepaste event twice; make sure it is not run
// again before our after paste function is called. // again before our after paste function is called.
this._awaitingPaste = false; this._awaitingPaste = false;
this.addEventListener( isIE ? 'beforecut' : 'cut', this._onCut ); this.addEventListener( isIE8or9or10 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIE ? 'beforepaste' : 'paste', this._onPaste ); this.addEventListener( isIE8or9or10 ? 'beforepaste' : 'paste', this._onPaste );
if ( isIE8 ) { if ( isIE8 ) {
this.addEventListener( 'keyup', this._ieSelAllClean ); this.addEventListener( 'keyup', this._ieSelAllClean );