RESOLVED FIXED 15381
execCommand justify modifies the contentEditable node
https://bugs.webkit.org/show_bug.cgi?id=15381
Summary execCommand justify modifies the contentEditable node
Nick Santos
Reported 2007-10-05 14:04:00 PDT
Steps to reproduce: 1) Create a contentEditable field with some text, and no display: block elements. 2) In javascript, call document.execCommand("justifyRight", false) Expected Result: A block-level element should be created around the text with style='text-align: right'. IE creates a <p> element. Actual Result: The contentEditable element has style='text-align: right.' Notes: As a general principle, execCommand should *never* modify the attributes of a node with contentEditable on. There are all sorts of reasons why this is bad: it may change the layout of the field itself, it makes it more difficult to get the contents of the field, etc. See the demo at the URL.
Attachments
patch (6.82 KB, patch)
2009-02-12 15:10 PST, Justin Garcia
eric: review+
Justin Garcia
Comment 1 2009-02-12 14:45:54 PST
This shouldn't be too hard to fix, ApplyStyleCommand::moveParagraphContentsToNewBlockIfNecessary just needs to know about this situation.
Justin Garcia
Comment 2 2009-02-12 14:51:25 PST
I'm testing a fix...
Justin Garcia
Comment 3 2009-02-12 15:10:28 PST
Eric Seidel (no email)
Comment 4 2009-02-13 09:35:59 PST
Comment on attachment 27624 [details] patch looks great! r=me.
Justin Garcia
Comment 5 2009-02-16 15:42:40 PST
Note You need to log in before you can comment on or make changes to this bug.