BUG: Elements in a Web page shift position when you format selected text (838467)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming)

SYMPTOMS

When you select text in a Web page, and then run the execCommand method with Italic as the parameter, you may notice that the elements in the Web page shift position.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section of this article.

MORE INFORMATION

Steps to reproduce the behavior

  1. Create an HTML file. To do this, follow these steps:
    1. Click Start, and then click Run. The Run dialog box appears.
    2. Type notepad in the Open box, and then click OK to start Notepad.
    3. Paste the following code in Notepad:
      <HTML>
      <HEAD>
      <SCRIPT language=jscript>
      		
      		function change()
      		{
      			var oSel = document.selection;
      			var oTxt = oSel.createRange();
      			oTxt.execCommand("Italic");
      			
      			oTxt = null;
      			oSel = null;		
      		}		
      		</SCRIPT>
      </HEAD>
      <BODY>
      <BUTTON onclick=change();>Italics</BUTTON>
      <br>
      <br>
      <br>
      <SPAN contentEditable=false>some data</SPAN> 
      &nbsp; 
      <SPAN contentEditable=false>some data</SPAN> &nbsp; 
      <INPUT id=Text1 contentEditable=false name=Text1> &nbsp; 
      <SPAN contentEditable=false>some data</SPAN> &nbsp; 
      <INPUT id=Text2 contentEditable=false name=Text2> &nbsp; 
      <SPAN contentEditable=false>some data</SPAN><BR>
      <SPAN contentEditable=false>some data</SPAN><BR><BR>
      <INPUT id=Text3 contentEditable=false name=Text3> &nbsp;<BR><BR><BR>
      <SPAN contentEditable=false>some data</SPAN> <BR>
      <SPAN contentEditable=false>some data</SPAN> <BR>
      </BODY>
      </HTML>
      
    4. On the File menu, click Save. The Save As dialog box appears.
    5. In the File name box, type the name of the file as Sample.html.
    6. In the Save as type list, click All Files, and then click Save.
  2. Open the Sample.html file that you saved in step 1. e in Microsoft Internet Explorer.
  3. Select any text on the Web page, and then click Italics. You may notice the behavior that is described in the "Symptoms" section.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web site:

Modification Type:MajorLast Reviewed:4/21/2006
Keywords:kbformat kbbug KB838467 kbAudDeveloper