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
Created attachment 71795 [details] Patch
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.
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.
Committed r70507: <http://trac.webkit.org/changeset/70507>