0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 07:13:08 -05:00

Remove last remnants of IE8 support.

This commit is contained in:
Neil Jenkins 2014-12-26 14:10:37 +07:00
parent 90623a51a2
commit 805f3cffff
4 changed files with 14 additions and 52 deletions

View file

@ -26,16 +26,15 @@ var isIOS = /iP(?:ad|hone|od)/.test( ua );
var isMac = /Mac OS X/.test( ua );
var isGecko = /Gecko\//.test( ua );
var isIE8or9or10 = /Trident\/[456]\./.test( ua );
var isIE8 = ( win.ie === 8 );
var isIElt11 = /Trident\/[456]\./.test( ua );
var isPresto = !!win.opera;
var isWebKit = /WebKit\//.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIE8or9or10 || isPresto;
var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit;
var losesSelectionOnBlur = isIE8or9or10;
var useTextFixer = isIElt11 || isPresto;
var cantFocusEmptyTextNodes = isIElt11 || isWebKit;
var losesSelectionOnBlur = isIElt11;
var hasBuggySplit = function ( doc ) {
var div = doc.createElement( 'DIV' ),
text = doc.createTextNode( '12' );
@ -1131,12 +1130,9 @@ function Squire ( doc ) {
// IE sometimes fires the beforepaste event twice; make sure it is not run
// again before our after paste function is called.
this._awaitingPaste = false;
this.addEventListener( isIE8or9or10 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIE8or9or10 ? 'beforepaste' : 'paste', this._onPaste );
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', this._onPaste );
if ( isIE8 ) {
this.addEventListener( 'keyup', this._ieSelAllClean );
}
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', this._onKey );
@ -2732,21 +2728,6 @@ var afterDelete = function ( self, range ) {
}
};
// If you select all in IE8 then type, it makes a P; replace it with
// a DIV.
if ( isIE8 ) {
proto._ieSelAllClean = function () {
var firstChild = this._body.firstChild;
if ( firstChild.nodeName === 'P' ) {
this._saveRangeToBookmark( this.getSelection() );
replaceWith( firstChild, this.createDefaultBlock([
empty( firstChild )
]));
this.setSelection( this._getRangeAndRemoveBookmark() );
}
};
}
var keyHandlers = {
enter: function ( self, event ) {
// We handle this ourselves

File diff suppressed because one or more lines are too long

View file

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

View file

@ -44,12 +44,9 @@ function Squire ( doc ) {
// IE sometimes fires the beforepaste event twice; make sure it is not run
// again before our after paste function is called.
this._awaitingPaste = false;
this.addEventListener( isIE8or9or10 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIE8or9or10 ? 'beforepaste' : 'paste', this._onPaste );
this.addEventListener( isIElt11 ? 'beforecut' : 'cut', this._onCut );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', this._onPaste );
if ( isIE8 ) {
this.addEventListener( 'keyup', this._ieSelAllClean );
}
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', this._onKey );
@ -1645,21 +1642,6 @@ var afterDelete = function ( self, range ) {
}
};
// If you select all in IE8 then type, it makes a P; replace it with
// a DIV.
if ( isIE8 ) {
proto._ieSelAllClean = function () {
var firstChild = this._body.firstChild;
if ( firstChild.nodeName === 'P' ) {
this._saveRangeToBookmark( this.getSelection() );
replaceWith( firstChild, this.createDefaultBlock([
empty( firstChild )
]));
this.setSelection( this._getRangeAndRemoveBookmark() );
}
};
}
var keyHandlers = {
enter: function ( self, event ) {
// We handle this ourselves