Bug 21843 - execCommand removeFormat is blowing away text outside the selection
Summary: execCommand removeFormat is blowing away text outside the selection
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL: http://www.plexode.com/cgi-bin/eval2....
Depends on: 43017
  Show dependency treegraph
Reported: 2008-10-23 16:55 PDT by Julie Parent
Modified: 2010-10-25 16:03 PDT (History)
2 users (show)

See Also:

Patch (2.54 KB, patch)
2010-10-25 14:21 PDT, Ryosuke Niwa
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julie Parent 2008-10-23 16:55:48 PDT
Given the following (bad) html: <ul><li>one</li><li>two</li>selection</ul>

1. Select the text "selection".
2. execCommand('removeFormat', false, null')

Result: html is "selection" (Where did "one" and "two" go???)
Expected result: <ul><li>one</li><li>two</li>selection</ul> (no change)

Use the provided url for a demo, just click "eval once".
Also seen in Chrome.
Comment 1 Eric Seidel (no email) 2009-03-10 13:46:18 PDT
Entertainingly if you start with:
and hit enter with your cursor just before "selection", then you get:

I'm not sure what we're supposed to do here.  Maybe we're supposed to make the HTML valid before we perform any operations on it?
Comment 2 Ryosuke Niwa 2010-10-25 14:07:12 PDT
Wow this is an interesting bug.  I'll add a test for it since this bug has been fixed since http://trac.webkit.org/changeset/70283.
Comment 3 Ryosuke Niwa 2010-10-25 14:21:06 PDT
Created attachment 71794 [details]
Comment 4 Ryosuke Niwa 2010-10-25 16:03:39 PDT
Committed r70500: <http://trac.webkit.org/changeset/70500>