I am trying to fix an application in IE11 and I stuck in this bug: In the older version of IE ther was a simple selection object but it is deprecated in IE11. The MSDN page
My Rangy library has code to convert a DOM-compatible range to an IE TextRange as part of providing DOM range and selection support in IE <= 8. The latest build exposes this conversion explicitly on the selection object:
var textRange = rangy.getSelection().getNativeTextRange();
Note that the getNativeTextRange()
method of a Rangy selection only exists in IE.
Another alternative is to use Rangy's TextRange module, which among other things adds an IE-like findText()
method to Rangy's range object, along with the class applier module to do the highlighting. This will work in all major browsers.
Demo: http://jsfiddle.net/sycqeev2/
I'm not sure what's supposed to happen in your demo when you highlight text and press a key, so I haven't attempted to do anything with that.