diff --git a/web/source/kmwcallback.ts b/web/source/kmwcallback.ts
index 6c0cb02cd2..642cba5c6f 100644
--- a/web/source/kmwcallback.ts
+++ b/web/source/kmwcallback.ts
@@ -415,10 +415,11 @@ class KeyboardInterface {
this.keymanweb['oninserttext'](dn,s);
}
+ var Ldoc: Document;
if(Pelem.body) {
- var Ldoc=Pelem;
+ Ldoc=Pelem;
} else {
- var Ldoc=Pelem.ownerDocument; // I1481 - integration with rich editors not working 100%
+ Ldoc=Pelem.ownerDocument; // I1481 - integration with rich editors not working 100%
}
var Li, Ldv;
@@ -494,55 +495,6 @@ class KeyboardInterface {
this._DeadkeyDeleteMatched(); // I3318
this._DeadkeyAdjustPos(LselectionStart, -dn + s._kmwLength()); // I3318
} // Internet Explorer (including IE9)
- } else if(Ldoc && (Ldv=Ldoc.selection)) { // build 77 - use elem.ownerDocument.selection
- if(Ldoc.body.isContentEditable || Ldoc.designMode.toLowerCase()=='on') { // I1295 - isContentEditable
- var _CacheableCommands = this._CacheCommands(Ldoc);
- }
-
- var Lrange = Ldv.createRange(), Ls1;
- if(Lrange.text != '') {
- Ldv.clear();
- dn = 0;
- } else {
- Lrange.collapse(true);
- }
-
- if(dn > 0) {
- Lrange.moveStart('character',-2*dn); // I3319 (next four lines
- var s0=Lrange.text,s1=s0._kmwSubstr(-dn);
- Lrange.collapse(false); //move start back to end
- Lrange.moveStart('character',-s1.length);
- } else {
- dn = 0;
- }
-
- Lrange.text = s;
-
- if(Ldoc.body.isContentEditable || Ldoc.designMode.toLowerCase()=='on') { // I1295 - isContentEditable
- Lrange.moveStart('character',-s.length);
-
- this._CacheCommandsReset(Ldoc, _CacheableCommands,Lrange.select);
- Lrange.moveStart('character',s.length);
- Lrange.select();
- }
- // Adjust deadkey positions
- if(dn >= 0) {
- // Pelem.selectionStart seems to exist here in IE 9 and is valid. This provides a possible approach, but may be wrong.
- // It appears safe to model the deadkey adjustment based on the non-IE9 code path's calculations.
- if(Pelem._KeymanWebSelectionStart != null) {// changed to allow a value of 0
- LselectionStart = Pelem._KeymanWebSelectionStart;
- } else {
- LselectionStart = Pelem.value._kmwCodeUnitToCodePoint(Pelem.selectionStart); // I3319
- }
-
- this._DeadkeyDeleteMatched(); // I3318
- this._DeadkeyAdjustPos(LselectionStart, -dn + s._kmwLength()); // I3318
- }
-
- DOMEventHandlers.states._Selection = Ldv.createRange();
- DOMEventHandlers.states._Selection.select();
- DOMEventHandlers.states._Selection.scrollIntoView();
- // Mozilla et al; IE9+ also recognizes setSelectionRange, but does not seem to work in exactly the same way as Mozilla
} else if (Pelem.setSelectionRange) {
var LselectionStart, LselectionEnd;
@@ -636,7 +588,7 @@ class KeyboardInterface {
* Description Build reate list of styles that can be applied in iframes
*/
private _CacheCommands = function(_Document: Document): StyleCommand[] { // I1204 - style application in IFRAMEs, I2192, I2134, I2192
- //var _CacheableBackColor=(_Document.selection?'hilitecolor':'backcolor');
+ //var _CacheableBackColor='backcolor';
var _CacheableCommands=[
new StyleCommand('backcolor',1), new StyleCommand('fontname',1), new StyleCommand('fontsize',1),
diff --git a/web/source/kmwdebug.js b/web/source/kmwdebug.js
index 245fe5a908..19348f5eea 100644
--- a/web/source/kmwdebug.js
+++ b/web/source/kmwdebug.js
@@ -140,9 +140,6 @@ if(!window['keyman']['initialized']) {
}
//Lelem.scrollIntoView(); //***temporarily disabled, JMD 23/12/11
//keymanweb._DivDebug.innerHTML = keymanweb._DivDebug.innerHTML + '
'+keymanweb._DebugDepth+Ps;
- //if(!document.selection)
- // keymanweb._DivDebug.scrollTop = (keymanweb._DivDebug.scrollHeight - keymanweb._DivDebug.clientHeight<0 ? 0 :
- // keymanweb._DivDebug.scrollHeight - keymanweb._DivDebug.clientHeight);
}
}
@@ -161,56 +158,25 @@ if(!window['keyman']['initialized']) {
_DebugDeadKeys = function(Pelem, Ps)
{
var Lt = "", Li, Lp = 0, Ls, Lj;
- if(document.selection)
+
+ // if(!keymanweb._IE) return true; //added test to avoid compiler warning 27/8 JMD // Commented-out after removal of document.selection 25/01/18 JAH
+
+ // Mozilla debug (table formatting removed)
+ if(Pelem.tagName == 'HTML') Ls = Pelem.innerHTML; else Ls = Pelem.value; Lt = ''; //span style="font-size: 12pt">';
+ if(typeof(Ls) === 'undefined') return;
+ for(Li = 0; Li <= Ls._kmwLength(); Li++) Lt += "<"+Ls._kmwCharAt(Li)+">"; //I3319
+ for(Li = 0; Li <= Ls._kmwLength(); Li++) //I3319
{
- // IE debug
- for(Li = 0; Li < kbdInterface._DeadKeys.length; Li++)
+ for(var Lj = 0; Lj < kbdInterface._DeadKeys.length; Lj++)
{
- if(kbdInterface._DeadKeys[Li].p > Lp) Lp = kbdInterface._DeadKeys[Li].p;
+ Lt = Lt + '['+kbdInterface._DeadKeys[Lj].p+':'+kbdInterface._DeadKeys[Lj].d+']';
}
- Ls = kbdInterface.context(Lp+1, Lp+1, Pelem); Lt = '';
- if(Ls !== false && Ls._kmwLength() > Lp) //I3319
- {
- /* We want to show the previous character in the context */
- Lt = Lt + Ls._kmwSubstr(0,1); Ls = Ls._kmwSlice(1); //I3319
- }
- for(Li = 0; Li <= Ls._kmwLength(); Li++) //I3319
- {
- for(Lj = 0; Lj < kbdInterface._DeadKeys.length; Lj++)
- {
- if(kbdInterface._DeadKeys[Lj].p == Ls._kmwLength() - Li) Lt = Lt + ''+kbdInterface._DeadKeys[Lj].d+''; //I3319
- }
- if(Li < Ls._kmwLength()) Lt = Lt + Ls._kmwCharAt(Li); //I3319
- }
-
- Lt = Lt + ' - ';
- for(Li = 0; Li < kbdInterface._DeadKeys.length; Li++)
- {
- Lt = Lt + 'dk['+Li+'] = {pos: '+kbdInterface._DeadKeys[Li].p+', deadKey: '+kbdInterface._DeadKeys[Li].d+'} ';
- }
-
- _Debug(Ps + ': ' + Lt);
- }
- else
- {
- if(!keymanweb._IE) return true; //added test to avoid compiler warning 27/8 JMD
-
- // Mozilla debug (table formatting removed)
- if(Pelem.tagName == 'HTML') Ls = Pelem.innerHTML; else Ls = Pelem.value; Lt = ''; //span style="font-size: 12pt">';
- if(typeof(Ls) === 'undefined') return;
- for(Li = 0; Li <= Ls._kmwLength(); Li++) Lt += "<"+Ls._kmwCharAt(Li)+">"; //I3319
- for(Li = 0; Li <= Ls._kmwLength(); Li++) //I3319
- {
- for(var Lj = 0; Lj < kbdInterface._DeadKeys.length; Lj++)
- {
- Lt = Lt + '['+kbdInterface._DeadKeys[Lj].p+':'+kbdInterface._DeadKeys[Lj].d+']';
- }
- if(Li < Ls._kmwLength()) Lt = Lt + Ls._kmwCharAt(Li);
- }
-
- //_Debug(Ps + ': ' + Lt);
- //Lt = Lt + keymanweb._DebugDepth + ' dk['+Li+'] = {pos: '+kbdInterface._DeadKeys[Li].p+', deadKey: '+kbdInterface._DeadKeys[Li].d+'}
';
+ if(Li < Ls._kmwLength()) Lt = Lt + Ls._kmwCharAt(Li);
}
+
+ //_Debug(Ps + ': ' + Lt);
+ //Lt = Lt + keymanweb._DebugDepth + ' dk['+Li+'] = {pos: '+kbdInterface._DeadKeys[Li].p+', deadKey: '+kbdInterface._DeadKeys[Li].d+'}
';
+
/*
var Lt = "", Li, Lp = 0;
diff --git a/web/source/kmwdomevents.ts b/web/source/kmwdomevents.ts
index 0ffcb6deaa..17235f3638 100644
--- a/web/source/kmwdomevents.ts
+++ b/web/source/kmwdomevents.ts
@@ -593,7 +593,7 @@ class DOMEventHandlers {
* Description Processes keydown event and passes data to keyboard.
*/
_KeyDown: (e: KeyboardEvent) => boolean = function(this: DOMEventHandlers, e: KeyboardEvent): boolean {
- var Ldv, eClass='';
+ var Ldv: Document, eClass='';
var activeKeyboard = this.keyman.keyboardManager.activeKeyboard;
var osk = this.keyman.osk;
var util = this.keyman.util;
@@ -648,11 +648,6 @@ class DOMEventHandlers {
this.keyman.keyboardManager.notifyKeyboard(0,Levent.Ltarg,1);
osk._UpdateVKShift(Levent, 0, 1);
}
-
- // I1207
- if((Ldv=Levent.Ltarg.ownerDocument) && (Ldv=Ldv.selection) && (Levent.Lcode<33 || Levent.Lcode>40)) {
- Ldv.createRange().select();
- }
if(!window.event) {
// I1466 - Convert the - keycode on mnemonic as well as positional layouts
@@ -858,15 +853,6 @@ class DOMEventHandlers {
keyboardManager.notifyKeyboard(0,Levent.Ltarg,0);
osk._UpdateVKShift(Levent, 0, 1); // I2187
}
-
- // I736 start
- var Ldv;
- if((Ldv=Levent.Ltarg.ownerDocument) && (Ldv=Ldv.selection) && Ldv.type != 'control') { // I1479 - avoid createRange on controls
- Ldv=Ldv.createRange();
- //if(Ldv.parentElement()==Levent.Ltarg) //I1505
- DOMEventHandlers.states._Selection = Ldv;
- }
- // I736 end
return false;
}.bind(this);
diff --git a/web/source/kmwembedded.ts b/web/source/kmwembedded.ts
index a1b9b9918e..97fd949531 100644
--- a/web/source/kmwembedded.ts
+++ b/web/source/kmwembedded.ts
@@ -166,18 +166,6 @@
//dbg(n+' '+ln+' '+Pelem.value._kmwSubstring(LselectionStart-n,LselectionStart-n+ln));
return Pelem.value._kmwSubstring(LselectionStart-n,LselectionStart-n+ln); //I3319, KMW-1
}
-
- else if(Ldoc && (Ldv=Ldoc.selection)) // build 77 - use elem.ownerDocument instead of document
- // I1481 - use Ldoc to get the ownerDocument when no selection is found
- {
- /* IE */
- var Lrange = Ldv.createRange();
- //if (Lrange.parentElement() == Pelem) { // build 77 - ignore parent of selection
- Lrange.moveStart('character',-2*n); //I3319
-
- return Lrange.text._kmwSubstr(-n)._kmwSubstring(0,ln); //I3319
- //}
- }
return "";
};
diff --git a/web/source/kmwnative.ts b/web/source/kmwnative.ts
index 7116eee505..04817a8649 100644
--- a/web/source/kmwnative.ts
+++ b/web/source/kmwnative.ts
@@ -134,13 +134,6 @@ if(!window['keyman']['initialized']) {
LselectionEnd = keymanweb._CachedSelectionEnd; // I3319
}
tempContext = Pelem.value._kmwSubstr(0, LselectionStart);
- } else if(Ldoc && (Ldv=Ldoc.selection)) { // build 77 - use elem.ownerDocument instead of document
- // I1481 - use Ldoc to get the ownerDocument when no selection is found
- /* IE */
- var Lrange = Ldv.createRange();
- //if (Lrange.parentElement() == Pelem) { // build 77 - ignore parent of selection
- Lrange.moveStart('character',-2*n); // allows for supp chars //I3319
- tempContext = Lrange.text;
}
if(tempContext._kmwLength() < n) {