WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
29164
execCommand('removeFormat') adds extra styles inside tables
https://bugs.webkit.org/show_bug.cgi?id=29164
Summary
execCommand('removeFormat') adds extra styles inside tables
Julie Parent
Reported
2009-09-10 17:17:26 PDT
1. Create a simple table, with a style inside a cell, for example: "<table><tr><td><b>foo</b></td></tr><tr><td>bar</td></tr></table>" 2. Select some styled text, for example: select "foo" 3. document.execCommand('removeFormat', false, null) Result: Extra apple-style-span added with border-spacing styles, for example: <table><tbody><tr><td><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px;">foo</span></td></tr><tr><td>bar</td></tr></tbody></table> Expected Result: Just the b tag is removed, for example: <table><tbody><tr><td>foo</td></tr><tr><td>bar</td></tr></tbody></table> Demo:
http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20contentEditable%20id%3D'editable'%3E%3Ctable%3E%3Ctr%3E%3Ctd%3E%3Cb%20id%3D'foo'%3Efoo%3C%2Fb%3E%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr%3E%3Ctd%3Ebar%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3C%2Fdiv%3E&ohh=1&ohj=1&jt=%2F%2F%20Select%20%22foo%22%0Avar%20rng%20%3D%20document.createRange()%3B%0Arng.setStart(foo.firstChild%2C%200)%3B%0Arng.setEnd(foo.firstChild%2C%20foo.firstChild.length)%3B%0Adocument.getSelection().addRange(rng)%3B%0A%0Adocument.execCommand('removeFormat'%2C%20false%2C%20null)%3B%0Aalert(editable.innerHTML)%3B%0A&ojh=0&ojj=0&ms=100&oth=0&otj=0&cex=1
Attachments
Patch
(2.26 KB, patch)
2010-10-25 14:29 PDT
,
Ryosuke Niwa
tony
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2010-10-25 14:29:19 PDT
Created
attachment 71795
[details]
Patch
Tony Chang
Comment 2
2010-10-25 15:14:05 PDT
Comment on
attachment 71795
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=71795&action=review
> LayoutTests/editing/execCommand/remove-format-in-table-cell.html:8 > +Markup.description('This tests RemoveFormant command "hello". "hello" should be the immediate child of td below and there should be no style attribute.');
Nit: I'm not sure what 'This tests RemoveFormant command "hello".' means. Can you rewrite it? Something like: This tests that RemoveFormat doesn't add extra span tags when inside a table cell.
Ryosuke Niwa
Comment 3
2010-10-25 17:03:29 PDT
Thanks for the review! (In reply to
comment #2
)
> (From update of
attachment 71795
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=71795&action=review
> > > LayoutTests/editing/execCommand/remove-format-in-table-cell.html:8 > > +Markup.description('This tests RemoveFormant command "hello". "hello" should be the immediate child of td below and there should be no style attribute.'); > > Nit: I'm not sure what 'This tests RemoveFormant command "hello".' means. Can you rewrite it? Something like: > This tests that RemoveFormat doesn't add extra span tags when inside a table cell.
This wasn't intended. Thanks for catching that. Will fix and land.
Ryosuke Niwa
Comment 4
2010-10-25 17:07:15 PDT
Committed
r70507
: <
http://trac.webkit.org/changeset/70507
>
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