From e7cef4981890a11157bd01de6eea3c1bc0b7900d Mon Sep 17 00:00:00 2001 From: Neil Jenkins Date: Thu, 2 Oct 2014 16:22:51 +0700 Subject: [PATCH] Rename isOpera -> isPresto. Opera now uses WebKit, but these tweaks are only for the Presto version. --- build/squire-raw.js | 12 ++++++------ source/Constants.js | 4 ++-- source/Editor.js | 6 +++--- source/Node.js | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build/squire-raw.js b/build/squire-raw.js index 54d5f24..73ef973 100644 --- a/build/squire-raw.js +++ b/build/squire-raw.js @@ -27,12 +27,12 @@ var isMac = /Mac OS X/.test( ua ); var isGecko = /Gecko\//.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua ); var isIE8 = ( win.ie === 8 ); -var isOpera = !!win.opera; +var isPresto = !!win.opera; var isWebKit = /WebKit\//.test( ua ); var ctrlKey = isMac ? 'meta-' : 'ctrl-'; -var useTextFixer = isIE8or9or10 || isOpera; +var useTextFixer = isIE8or9or10 || isPresto; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit; var losesSelectionOnBlur = isIE8or9or10; var hasBuggySplit = ( function () { @@ -497,7 +497,7 @@ function mergeWithBlock ( block, next, range ) { // Steps to reproduce bug: Type "a-b-c" (where - is return) // then backspace twice. The cursor goes to the top instead // of after "b". - if ( isOpera && ( last = block.lastChild ) && last.nodeName === 'BR' ) { + if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) { block.removeChild( last ); } } @@ -1230,7 +1230,7 @@ function Squire ( doc ) { this.addEventListener( 'keyup', this._ieSelAllClean ); } // 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. // 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 // you type anything! if ( !child || child.nodeName === 'BR' || - ( child.nodeType === TEXT_NODE && !isOpera ) ) { + ( child.nodeType === TEXT_NODE && !isPresto ) ) { break; } nodeAfterSplit = child; @@ -3167,7 +3167,7 @@ proto._onKey = function ( event ) { // On keypress, delete and '.' both have event.keyCode 46 // Must check event.which to differentiate. - if ( isOpera && event.which === 46 ) { + if ( isPresto && event.which === 46 ) { key = '.'; } diff --git a/source/Constants.js b/source/Constants.js index 0a3ff5a..8e156db 100644 --- a/source/Constants.js +++ b/source/Constants.js @@ -22,12 +22,12 @@ var isMac = /Mac OS X/.test( ua ); var isGecko = /Gecko\//.test( ua ); var isIE8or9or10 = /Trident\/[456]\./.test( ua ); var isIE8 = ( win.ie === 8 ); -var isOpera = !!win.opera; +var isPresto = !!win.opera; var isWebKit = /WebKit\//.test( ua ); var ctrlKey = isMac ? 'meta-' : 'ctrl-'; -var useTextFixer = isIE8or9or10 || isOpera; +var useTextFixer = isIE8or9or10 || isPresto; var cantFocusEmptyTextNodes = isIE8or9or10 || isWebKit; var losesSelectionOnBlur = isIE8or9or10; var hasBuggySplit = ( function () { diff --git a/source/Editor.js b/source/Editor.js index 93a4883..29b8234 100644 --- a/source/Editor.js +++ b/source/Editor.js @@ -113,7 +113,7 @@ function Squire ( doc ) { this.addEventListener( 'keyup', this._ieSelAllClean ); } // 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. // 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 // you type anything! if ( !child || child.nodeName === 'BR' || - ( child.nodeType === TEXT_NODE && !isOpera ) ) { + ( child.nodeType === TEXT_NODE && !isPresto ) ) { break; } nodeAfterSplit = child; @@ -2050,7 +2050,7 @@ proto._onKey = function ( event ) { // On keypress, delete and '.' both have event.keyCode 46 // Must check event.which to differentiate. - if ( isOpera && event.which === 46 ) { + if ( isPresto && event.which === 46 ) { key = '.'; } diff --git a/source/Node.js b/source/Node.js index c037a28..f58cae3 100644 --- a/source/Node.js +++ b/source/Node.js @@ -358,7 +358,7 @@ function mergeWithBlock ( block, next, range ) { // Steps to reproduce bug: Type "a-b-c" (where - is return) // then backspace twice. The cursor goes to the top instead // of after "b". - if ( isOpera && ( last = block.lastChild ) && last.nodeName === 'BR' ) { + if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) { block.removeChild( last ); } }