Open Bug 501734 Opened 15 years ago Updated 3 years ago

Underline/Italic/Bold sometimes applied to u/i/b tag before selection instead of selection

Categories

(Core :: DOM: Editor, defect, P5)

1.9.1 Branch
x86
Windows XP
defect

Tracking

()

People

(Reporter: annie.sullivan, Unassigned)

References

()

Details

Steps to reproduce:
(doesn't always happen, but below test case repros 100% for me in FF3 on WinXP and Linux)
1. Create a contenteditable region or designmode iframe
2. Enter some text spanning multiple lines, underline the last word in the first line.
3. On the next line, put some text in subscript and then underline it.

Actual Result:
Subscript text is moved into previous <u> tag.

Expected Result:
Subscript text is not moved, just wrapped in a <u> tag.

Also occurs if you replace 'underline' with 'bold' or 'italic' in the steps above.

Test Case:
http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20id%3D%22editor%22%20contenteditable%3D%22true%22%20style%3D%22font-family%3Amonspace%3B%20font-size%3A20px%3Bwidth%3A70px%22%3Em%20m%20%3Cu%3Em%3C%2Fu%3E%20m%20w%3Csub%3Eb%3C%2Fsub%3E%20m%3C%2Fdiv%3E&ohh=1&ohj=1&jt=var%20div%20%3D%20document.getElementById(%27editor%27)%3B%0Adiv.focus()%3B%0Avar%20sel%20%3D%20window.getSelection()%3B%0Avar%20range%20%3D%20sel.getRangeAt(0)%3B%0Arange.setStart(div.childNodes[2]%2C%203)%3B%0Arange.setEnd(div%2C%204)%3B%0Asel.removeAllRanges()%3B%0Asel.addRange(range)%3B%0Adocument.execCommand(%27styleWithCSS%27%2C%20false%2C%20false)%3B%0Adocument.execCommand(%27underline%27%2C%20false%2C%20null)%3B%0A%0A&ojh=0&ojj=0&ms=100&oth=0&otj=0&cex=0

Actual Result:
Selects "wb", applies underline execCommand, and the result is that "b" is moved into the previous <u> tag

Expected Result (works in Chrome):
Selects "wb", applies underline to "wb".

Bulk-downgrade of unassigned, >=5 years untouched DOM/Storage bugs' priority and severity.

If you have reason to believe this is wrong, please write a comment and ni :jstutte.

Severity: normal → S4
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.