Welcome to ClipClip!
Already a Member? Sign In
  • W3c Range in Internet Explorer

    Today I started to write my own W3c Range Implementation for Internet Explorer. The implementation contains a Selection object and a Range object.

    setStart(), setEnd(), collapse(), startContainer, endContainer, startOffset, endOffset and collapsed have been implemented so far.

    An example of what is possible yet:

    
    <script src="function.prototype.js" type="text/javascript" />
    <script src="range.js" type="text/javascript" />
    <script type="text/javascript">
      window.onload = function () {
        var sel   = new Selection();
        var range = new Range();
    
        range.setStart(someTextNode, 4);
        range.setEnd(someElementNode, 2);
        sel.addRange(range);
      }
    </script>
    
    

    The result will be exactly the same for Internet Explorer as for browsers which implement W3c Range correctly.

    Also the decomposition of an Internet Explorer TextRange to a W3c Range is possible. By this, you are allowed to retrieve the startContainer and startOffset properties of the current selection. pretty neat!

    an example of what is possible so far

 

Comments

No comments yet

Please sign in to comment.