I am facing an issue with ajax combo box in ie 11, where the intellisense feature is not working.
In the below code which is executed in script resource.axd
var userRange = document.selection.createRange();
undefined value is being returned in ie 11 where as in ie 10 , it is returning the current length of the text in the combo box.
This is leading to failure.
Any suggestions/workarounds would be of great assitance.
I used the latest available ajax components updated using nuget.
Thanks in advance
code:
_getTextSelectionInfo: function (textBox, e) {
var info = new Object();
info.strategy = this._getTextSelectionStrategy();
if (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft) {
var userRange = document.selection.createRange();
info.selectionStart = 0;
info.selectionEnd = textBox.value.length;
while (userRange.moveStart('character', -1) != 0) {
info.selectionStart++;
}
while (userRange.moveEnd('character', 1) != 0) {
info.selectionEnd--;
}
}
else if (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C) {
info.selectionStart = textBox.selectionStart;
info.selectionEnd = textBox.selectionEnd;
}
info.typedCharacter = String.fromCharCode(e.charCode);
info.textBoxValue = textBox.value;
info.selectionPrefix = (info.textBoxValue.length >= info.selectionStart)
? info.textBoxValue.substring(0, info.selectionStart)
: '';
info.selectionText = (info.textBoxValue.length >= info.selectionEnd)
? info.textBoxValue.substring(info.selectionStart, info.selectionEnd)
: '';
info.selectionSuffix = (info.textBoxValue.length >= info.selectionEnd)
? info.textBoxValue.substring(info.selectionEnd, info.textBoxValue.length)
: '';
info.selectionTextFirst = info.selectionText.substring(0, 1);
return info;
},
Comments: Took a look into this. I wish I understood the whole toolkit solution better as I would fix it myself. There is a feature check to see if the browser understands "createTextRange" in the "_getTextSelectionStrategy" function. IE11 still understands this IE only function (for some odd reason since it doesn't understand createRange() anymore) so this code still thinks it's IE10 or earlier. I wonder if just swapping the if/else statement to first check to see if it's W3C compliant would be better. As it is, I wonder why this check is even happening in the first place. IE9+ all know .selectionStart/.selectionEnd. Why not reverse the feature check and make IE8- the secondary check? In any case, I'm not sure if this is even the right venue to discuss this or if there is a better forum for discussing issues with the toolkit. but I'll leave this comment here anyways. thanks.
In the below code which is executed in script resource.axd
var userRange = document.selection.createRange();
undefined value is being returned in ie 11 where as in ie 10 , it is returning the current length of the text in the combo box.
This is leading to failure.
Any suggestions/workarounds would be of great assitance.
I used the latest available ajax components updated using nuget.
Thanks in advance
code:
_getTextSelectionInfo: function (textBox, e) {
var info = new Object();
info.strategy = this._getTextSelectionStrategy();
if (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft) {
var userRange = document.selection.createRange();
info.selectionStart = 0;
info.selectionEnd = textBox.value.length;
while (userRange.moveStart('character', -1) != 0) {
info.selectionStart++;
}
while (userRange.moveEnd('character', 1) != 0) {
info.selectionEnd--;
}
}
else if (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C) {
info.selectionStart = textBox.selectionStart;
info.selectionEnd = textBox.selectionEnd;
}
info.typedCharacter = String.fromCharCode(e.charCode);
info.textBoxValue = textBox.value;
info.selectionPrefix = (info.textBoxValue.length >= info.selectionStart)
? info.textBoxValue.substring(0, info.selectionStart)
: '';
info.selectionText = (info.textBoxValue.length >= info.selectionEnd)
? info.textBoxValue.substring(info.selectionStart, info.selectionEnd)
: '';
info.selectionSuffix = (info.textBoxValue.length >= info.selectionEnd)
? info.textBoxValue.substring(info.selectionEnd, info.textBoxValue.length)
: '';
info.selectionTextFirst = info.selectionText.substring(0, 1);
return info;
},
Comments: Took a look into this. I wish I understood the whole toolkit solution better as I would fix it myself. There is a feature check to see if the browser understands "createTextRange" in the "_getTextSelectionStrategy" function. IE11 still understands this IE only function (for some odd reason since it doesn't understand createRange() anymore) so this code still thinks it's IE10 or earlier. I wonder if just swapping the if/else statement to first check to see if it's W3C compliant would be better. As it is, I wonder why this check is even happening in the first place. IE9+ all know .selectionStart/.selectionEnd. Why not reverse the feature check and make IE8- the secondary check? In any case, I'm not sure if this is even the right venue to discuss this or if there is a better forum for discussing issues with the toolkit. but I'll leave this comment here anyways. thanks.