WebKit editing commands should remove empty (attribute-less) span tags (like FF does) Right now we do something like this: <span style="font-weight: bold">test</span> document.execCommand("bold", false, null); <span>test</span> where as FF would remove the same <span> tags. After talking with Ojan and Julie here @ the Goog (who have both written a lot of JS HTML Editing code), we agree that FF's behavior is more what authors will like. Authors can trivially cause us to leave the <span> tags, but adding any attribute. For example <span a> would cause us to leave the span tag instead of removing it (after my fix). Test case (and fix) forthcoming.
Created attachment 26946 [details] Remove <span> turds left by editing commands LayoutTests/ChangeLog | 12 ++++++ .../execCommand/empty-span-removal-expected.txt | 14 +++++++ .../editing/execCommand/empty-span-removal.html | 13 ++++++ .../execCommand/resources/empty-span-removal.js | 40 ++++++++++++++++++++ .../editing/execCommand/toggle-styles-expected.txt | 12 +++--- WebCore/ChangeLog | 21 ++++++++++ WebCore/editing/ApplyStyleCommand.cpp | 28 +++++++++++--- 7 files changed, 128 insertions(+), 12 deletions(-)
Already landed.