JScript: moveEnd() not working - by B64BF270-20FB-4651-80D9-69DB1CF3AD09

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

ID 609778 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/3/2010 3:18:46 AM
Access Restriction Public


The moveEnd("character") and moveEnd("word") methods/parameters of TextRange are not working in IE9 Beta ("IE=9" or "IE=edge" mode). They select nothing.

This was found for a TextRange on the BODY element (not a user selection or form elements).

moveEnd("sentence") is working. All 3 parameters are working in IE9 Beta in "IE=8" mode.
Sign in to post a comment.
Posted by Microsoft on 1/12/2012 at 7:19 AM
Thank you for your feedback.

The issue you are reporting is by design. This happens due to change in whitespace handling in IE9 where whitespaces as being treated as “words”. Text range as a legacy component is deprecated in IE9 mode.
Here is how you can work around the behavior:

<meta http-equiv="X-UA-Compatible" content="IE=9" />

        hi world hi world hi world hi world
    var range = document.body.createTextRange();
    range.moveStart("word", 3);
    range.moveEnd("word", -4);

Best regards,

The Internet Explorer Team