Closed Bug 511030 Opened 16 years ago Closed 15 years ago

Cursor position is misplaced when we try to select an empty text range following a BR

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: vkarun, Unassigned)

Details

(Whiteboard: [CLOSEME 2011-1-1])

User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9) Gecko/2008052912 Firefox/3.0 Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9) Gecko/2008052912 Firefox/3.0 The cursor position is misplaced when we create and select a text range from the contents of an empty text node that follows a BR. Reproducible: Always Steps to Reproduce: Click on the following plexode links to find the difference between actual and expected results. Actual Results: The plexode demo given below shows this behavior. The cursor should have been around the text node but was placed at the beginning of the text node preceding the BR. http://www.plexode.com/cgi-bin/eval3.py#ht=%3Ciframe%20id%3D%22foo%22%3E%3C%2Fiframe%3E&ohh=1&ohj=1&jt=iframe%20%3D%20document.getElementById(%22foo%22)%3B%0Adoc%20%3D%20iframe.contentDocument%3B%0Adoc.designMode%20%3D%20%22on%22%3B%0Aiframe.contentWindow.focus()%3B%0Adoc.execCommand(%22inserthtml%22%2C%20false%2C%20%22one%3Cbr%20id%3D%27br%27%3E%22)%3B%0Arange%20%3D%20doc.createRange()%3B%0Abr%20%3D%20doc.getElementById(%22br%22)%3B%0Atx%20%3D%20doc.createTextNode(%22%22)%3B%0Abr.parentNode.appendChild(tx)%3B%0Arange.setStart(tx%2C%200)%3B%0Arange.setEnd(tx%2C%200)%3B%0Aselection%20%3D%20iframe.contentWindow.getSelection()%3B%0Aselection.removeAllRanges()%3B%0Aselection.addRange(range)%3B%0A%0A%0A&ojh=0&ojj=0&ms=500&oth=0&otj=0&cex=0 Expected Results: This plexode demo shows the expected cursor position with a non-empty text node. http://www.plexode.com/cgi-bin/eval3.py#ht=%3Ciframe%20id%3D%22foo%22%3E%3C%2Fiframe%3E&ohh=1&ohj=1&jt=iframe%20%3D%20document.getElementById(%22foo%22)%3B%0Adoc%20%3D%20iframe.contentDocument%3B%0Adoc.designMode%20%3D%20%22on%22%3B%0Aiframe.contentWindow.focus()%3B%0Adoc.execCommand(%22inserthtml%22%2C%20false%2C%20%22one%3Cbr%20id%3D%27br%27%3E%22)%3B%0Arange%20%3D%20doc.createRange()%3B%0Abr%20%3D%20doc.getElementById(%22br%22)%3B%0Atx%20%3D%20doc.createTextNode(%22X%22)%3B%0Abr.parentNode.appendChild(tx)%3B%0Arange.setStart(tx%2C%200)%3B%0Arange.setEnd(tx%2C%200)%3B%0Aselection%20%3D%20iframe.contentWindow.getSelection()%3B%0Aselection.removeAllRanges()%3B%0Aselection.addRange(range)%3B%0A%0A%0A&ojh=0&ojj=0&ms=500&oth=0&otj=0&cex=0
Reporter, are you still seeing this issue with Firefox 3.6.12 or later in safe mode? If not, please close. These links can help you in your testing. http://support.mozilla.com/kb/Safe+Mode http://support.mozilla.com/kb/Managing+profiles Also, please consider using the most recent Firefox 4 beta build, your bug may be resolved there.
Whiteboard: [CLOSEME 2011-1-1]
No reply, INCOMPLETE. Please retest with Firefox 3.6.13 or later and a new profile (http://support.mozilla.com/kb/Managing+profiles). If you continue to see this issue with the newest firefox and a new profile, then please comment on this bug.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
I still see this on Gecko/20101206 Firefox/4.0b8pre It's not that hard to check yourself. Click on the above link, and in the page that opens up, click the "eval JS now" button. The first link shows the wrong behavior: the cursor shows up at the end of the text "one", blinks once, and disappears. The second link shows how it should work (except that the "X" shouldn't have to be there): The cursor shows up on the second line and stays there blinking.
You need to log in before you can comment on or make changes to this bug.