WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
28472
webkit can not unformat super- and sub-script containing BR
https://bugs.webkit.org/show_bug.cgi?id=28472
Summary
webkit can not unformat super- and sub-script containing BR
Philip Tucker
Reported
2009-08-19 13:09:43 PDT
The latest version of WebKit (532) fixed a bug where contentEditable could not unformat SUB and SUPER tags. But it still fails when the text contains a BR. e.g., For this HTML ... <div id="editor" contenteditable=true>super<sup>script<img></sup></div> ... if I select "script" and execCommand("superscript"), it works correctly, it simply removes the super tags. But if I change the HTML to this ... <div id="editor" contenteditable=true>super<sup>script<br></sup></div> ... "script" stays superscripted, and the underlying HTML becomes this ugliness ... <div id="editor" contenteditable=true>super<sup><span class=Apple-style-span style="vertical-align: baseline;">script</span><br></sup></div> Example:
http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20id%3D%22editor%22%20contenteditable%3Dtrue%3Esuper%3Csup%3Escript%3Cbr%3E%3C%2Fsup%3E%3C%2Fdiv%3E%0A&ohh=1&ohj=1&jt=var%20div%20%3D%20document.getElementById('editor')%3B%0A%0A%2F%2F%20Change%20this%20to%20select%20a%20range%0AselectRange(div%2C%201%2C%20div%2C%202)%3B%0A%0A%2F%2F%20Change%20this%20to%20run%20execCommand%0Adocument.execCommand('superscript'%2C%20false%2C%20null)%3B%0A%0Afunction%20selectRange(startNode%2C%20startOffset%2C%20endNode%2C%20endOffset)%20%7B%0A%20%20var%20sel%20%3D%20window.getSelection()%3B%0A%20%20var%20range%20%3D%20null%3B%0A%20%20try%20%7B%0A%20%20%20%20range%20%3D%20sel.getRangeAt(0)%3B%0A%20%20%7D%20catch(ex)%20%7B%0A%20%20%20%20range%20%3D%20document.createRange()%3B%0A%20%20%7D%0A%20%20range.setStart(startNode%2C%20startOffset)%3B%0A%20%20range.setEnd(endNode%2C%20endOffset)%3B%0A%20%20sel.removeAllRanges()%3B%0A%20%20sel.addRange(range)%3B%0A%7D&ojh=1&ojj=1&ms=100&oth=0&otj=0&cex=1
Attachments
Add attachment
proposed patch, testcase, etc.
Aryeh Gregor
Comment 1
2011-08-19 13:11:00 PDT
Cannot reproduce in Chrome 15.0.849.0 dev. It works as expected for me. Actually, it goes a bit further and removes the <sup> entirely, not even leaving the part around the unselected <br>, but I guess that's due to selection normalization.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug