There appears to be an error in an auto generated script when using the Ajax Toolkit HTMLEditor Extender with a textbox in IE 11. It doesn't occur in Firefox, Chrome, or other versions of IE. Following is the header of the "Auto Generated" script file where the error happens.
// Name: HtmlEditorExtender.HtmlEditorExtenderBehavior.debug.js
// Assembly: AjaxControlToolkit
// Version: 4.1.7.1213
// FileVersion: 4.1.7.1213
// (c) 2010 CodePlex Foundation
/// <reference name='MicrosoftAjax.js' />
/// <reference path='../ExtenderBase/BaseScripts.js' />
/// <reference path='../Common/Common.js' />
/// <reference path="~/Common/Common.pre.js" />
Following is the the code snippet where error occurs:
```
_editableDiv_submit: function () {
var char = 3;
var sel = null;
setTimeout(function () {
if (this._editableDiv != null)
this._editableDiv.focus();
}, 0);
if (Sys.Browser.agent != Sys.Browser.Firefox) {
if (document.selection) {
sel = document.selection.createRange();
sel.moveStart('character', char);
sel.select();
}
else {
sel = window.getSelection();
--> ___sel.collapse(this._editableDiv.firstChild, char);___
}
}
this._textbox._element.value = this._encodeHtml();
},
```
When execution reaches the line with the arrow in the code above, even thought this._editablediv contains the ID of the HTMLeditor extender, the firstchild of this._editablediv is empty and is set to Nothing producing an error.
It appears that the issue is only with IE 11. Another user tested Toolkit and also found that the issue is only appearing in IE 11, When he tested it in lower versions of IE like me, it worked fine, The reason seems to be that before version 11, IE handled the document.selection, but in IE 11 that is not used and so when the code reaches the arrowed line in the auto generated script shown above it doesn't work for IE 11.
Thanks!
David
Comments: I have also tested other version of toolkit with IE 11 and from what I can tell it appears to be an issue going back to at least version 4.1.7.0725 of Toolkit.
// Name: HtmlEditorExtender.HtmlEditorExtenderBehavior.debug.js
// Assembly: AjaxControlToolkit
// Version: 4.1.7.1213
// FileVersion: 4.1.7.1213
// (c) 2010 CodePlex Foundation
/// <reference name='MicrosoftAjax.js' />
/// <reference path='../ExtenderBase/BaseScripts.js' />
/// <reference path='../Common/Common.js' />
/// <reference path="~/Common/Common.pre.js" />
Following is the the code snippet where error occurs:
```
_editableDiv_submit: function () {
var char = 3;
var sel = null;
setTimeout(function () {
if (this._editableDiv != null)
this._editableDiv.focus();
}, 0);
if (Sys.Browser.agent != Sys.Browser.Firefox) {
if (document.selection) {
sel = document.selection.createRange();
sel.moveStart('character', char);
sel.select();
}
else {
sel = window.getSelection();
--> ___sel.collapse(this._editableDiv.firstChild, char);___
}
}
this._textbox._element.value = this._encodeHtml();
},
```
When execution reaches the line with the arrow in the code above, even thought this._editablediv contains the ID of the HTMLeditor extender, the firstchild of this._editablediv is empty and is set to Nothing producing an error.
It appears that the issue is only with IE 11. Another user tested Toolkit and also found that the issue is only appearing in IE 11, When he tested it in lower versions of IE like me, it worked fine, The reason seems to be that before version 11, IE handled the document.selection, but in IE 11 that is not used and so when the code reaches the arrowed line in the auto generated script shown above it doesn't work for IE 11.
Thanks!
David
Comments: I have also tested other version of toolkit with IE 11 and from what I can tell it appears to be an issue going back to at least version 4.1.7.0725 of Toolkit.