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

Rename isOpera -> isPresto.

Opera now uses WebKit, but these tweaks are only for the Presto version.
This commit is contained in:
Neil Jenkins 2014-10-02 16:22:51 +07:00
parent a408fcaca6
commit e7cef49818
4 changed files with 12 additions and 12 deletions

View file

@ -27,12 +27,12 @@ var isMac = /Mac OS X/.test( ua );
var isGecko = /Gecko\//.test( ua ); var isGecko = /Gecko\//.test( ua );
var isIE8or9or10 = /Trident\/[456]\./.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua );
var isIE8 = ( win.ie === 8 ); var isIE8 = ( win.ie === 8 );
var isOpera = !!win.opera; var isPresto = !!win.opera;
var isWebKit = /WebKit\//.test( ua ); var isWebKit = /WebKit\//.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-'; var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIE8or9or10 || isOpera; var useTextFixer = isIE8or9or10 || isPresto;
var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit;
var losesSelectionOnBlur = isIE8or9or10; var losesSelectionOnBlur = isIE8or9or10;
var hasBuggySplit = ( function () { var hasBuggySplit = ( function () {
@ -497,7 +497,7 @@ function mergeWithBlock ( block, next, range ) {
// Steps to reproduce bug: Type "a-b-c" (where - is return) // Steps to reproduce bug: Type "a-b-c" (where - is return)
// then backspace twice. The cursor goes to the top instead // then backspace twice. The cursor goes to the top instead
// of after "b". // of after "b".
if ( isOpera && ( last = block.lastChild ) && last.nodeName === 'BR' ) { if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) {
block.removeChild( last ); block.removeChild( last );
} }
} }
@ -1230,7 +1230,7 @@ function Squire ( doc ) {
this.addEventListener( 'keyup', this._ieSelAllClean ); this.addEventListener( 'keyup', this._ieSelAllClean );
} }
// Opera does not fire keydown repeatedly. // Opera does not fire keydown repeatedly.
this.addEventListener( isOpera ? 'keypress' : 'keydown', this._onKey ); this.addEventListener( isPresto ? 'keypress' : 'keydown', this._onKey );
// Fix IE8/9's buggy implementation of Text#splitText. // Fix IE8/9's buggy implementation of Text#splitText.
// If the split is at the end of the node, it doesn't insert the newly split // If the split is at the end of the node, it doesn't insert the newly split
@ -2947,7 +2947,7 @@ var keyHandlers = {
// If you try to select the contents of a 'BR', FF will not let // If you try to select the contents of a 'BR', FF will not let
// you type anything! // you type anything!
if ( !child || child.nodeName === 'BR' || if ( !child || child.nodeName === 'BR' ||
( child.nodeType === TEXT_NODE && !isOpera ) ) { ( child.nodeType === TEXT_NODE && !isPresto ) ) {
break; break;
} }
nodeAfterSplit = child; nodeAfterSplit = child;
@ -3167,7 +3167,7 @@ proto._onKey = function ( event ) {
// On keypress, delete and '.' both have event.keyCode 46 // On keypress, delete and '.' both have event.keyCode 46
// Must check event.which to differentiate. // Must check event.which to differentiate.
if ( isOpera && event.which === 46 ) { if ( isPresto && event.which === 46 ) {
key = '.'; key = '.';
} }

View file

@ -22,12 +22,12 @@ var isMac = /Mac OS X/.test( ua );
var isGecko = /Gecko\//.test( ua ); var isGecko = /Gecko\//.test( ua );
var isIE8or9or10 = /Trident\/[456]\./.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua );
var isIE8 = ( win.ie === 8 ); var isIE8 = ( win.ie === 8 );
var isOpera = !!win.opera; var isPresto = !!win.opera;
var isWebKit = /WebKit\//.test( ua ); var isWebKit = /WebKit\//.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-'; var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIE8or9or10 || isOpera; var useTextFixer = isIE8or9or10 || isPresto;
var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit;
var losesSelectionOnBlur = isIE8or9or10; var losesSelectionOnBlur = isIE8or9or10;
var hasBuggySplit = ( function () { var hasBuggySplit = ( function () {

View file

@ -113,7 +113,7 @@ function Squire ( doc ) {
this.addEventListener( 'keyup', this._ieSelAllClean ); this.addEventListener( 'keyup', this._ieSelAllClean );
} }
// Opera does not fire keydown repeatedly. // Opera does not fire keydown repeatedly.
this.addEventListener( isOpera ? 'keypress' : 'keydown', this._onKey ); this.addEventListener( isPresto ? 'keypress' : 'keydown', this._onKey );
// Fix IE8/9's buggy implementation of Text#splitText. // Fix IE8/9's buggy implementation of Text#splitText.
// If the split is at the end of the node, it doesn't insert the newly split // If the split is at the end of the node, it doesn't insert the newly split
@ -1830,7 +1830,7 @@ var keyHandlers = {
// If you try to select the contents of a 'BR', FF will not let // If you try to select the contents of a 'BR', FF will not let
// you type anything! // you type anything!
if ( !child || child.nodeName === 'BR' || if ( !child || child.nodeName === 'BR' ||
( child.nodeType === TEXT_NODE && !isOpera ) ) { ( child.nodeType === TEXT_NODE && !isPresto ) ) {
break; break;
} }
nodeAfterSplit = child; nodeAfterSplit = child;
@ -2050,7 +2050,7 @@ proto._onKey = function ( event ) {
// On keypress, delete and '.' both have event.keyCode 46 // On keypress, delete and '.' both have event.keyCode 46
// Must check event.which to differentiate. // Must check event.which to differentiate.
if ( isOpera && event.which === 46 ) { if ( isPresto && event.which === 46 ) {
key = '.'; key = '.';
} }

View file

@ -358,7 +358,7 @@ function mergeWithBlock ( block, next, range ) {
// Steps to reproduce bug: Type "a-b-c" (where - is return) // Steps to reproduce bug: Type "a-b-c" (where - is return)
// then backspace twice. The cursor goes to the top instead // then backspace twice. The cursor goes to the top instead
// of after "b". // of after "b".
if ( isOpera && ( last = block.lastChild ) && last.nodeName === 'BR' ) { if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) {
block.removeChild( last ); block.removeChild( last );
} }
} }