Bug 23486 - WebKit execCommand bold/italic should remove strong/em tags (since IE inserts them)
Summary: WebKit execCommand bold/italic should remove strong/em tags (since IE inserts...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Eric Seidel (no email)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-22 16:58 PST by Eric Seidel (no email)
Modified: 2009-02-04 11:44 PST (History)
3 users (show)

See Also:


Attachments
Remove <strong>/<em> when toggling bold/italic to match IE (not FF) (3.45 KB, patch)
2009-01-22 17:34 PST, Eric Seidel (no email)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-01-22 16:58:31 PST
WebKit execCommand bold/italic should remove strong/em tags (since IE inserts them)

Our current behavior can be seen here:
http://trac.webkit.org/browser/trunk/LayoutTests/editing/execCommand/toggle-styles-expected.txt?rev=40139

FAIL italic removing em -- <em><span class="Apple-style-span" style="font-style: normal;">test</span></em>

The problem is that IE inserts <em> for the "italic" execCommand and <strong> for the "bold" command.  So we should remove them if we want to interoperate nicely.

FF3 does not remove either of these tags.  Ojan has strongly recommended that we diverge from FF here and remove the tags just like we currently remove <b> and <i>.
Comment 1 Eric Seidel (no email) 2009-01-22 17:34:49 PST
Created attachment 26948 [details]
Remove <strong>/<em> when toggling bold/italic to match IE (not FF)

 LayoutTests/ChangeLog                              |    9 +++++++++
 .../editing/execCommand/toggle-styles-expected.txt |    4 ++--
 WebCore/ChangeLog                                  |   12 ++++++++++++
 WebCore/editing/ApplyStyleCommand.cpp              |    6 ++++--
 4 files changed, 27 insertions(+), 4 deletions(-)
Comment 2 Oliver Hunt 2009-01-22 17:48:41 PST
Why do we want to diverge from ffx? "<insert name here> recommends" is not valid justification
Comment 3 Eric Seidel (no email) 2009-01-22 18:02:01 PST
Actually, I didn't give the right information.  FF's current behavior is clearly wrong IMO.   So we're not really diverging.  We're diverging from our old behavior, which if you're a semantic web lover, is possibly more "correct" than this new behavior... but less useful, and less IE-compatible.

<strong>foo</strong>
document.execCommand("bold")

produces:

WebKit trunk:
<strong><span class="Apple-style-span" style="font-weight: normal;">test</span></strong>

IE:
test

FF
<strong>test</strong> // clearly wrong IMO

after patch:
test
Comment 4 Darin Adler 2009-01-23 17:54:14 PST
Comment on attachment 26948 [details]
Remove <strong>/<em> when toggling bold/italic to match IE (not FF)

Seems OK. r=me
Comment 5 Eric Seidel (no email) 2009-02-04 11:44:51 PST
Landed.