[webkit-dev] [HTML Editing] WebKit's implementation of removeFormat is completely different from other UAs.

Ryosuke Niwa rniwa at webkit.org
Sun Jul 25 01:03:47 PDT 2010


Are there Apple or third-party products that heavily rely on the current
implementation of RemoveFormatCommand?
If not, I want to completely re-implement RemoveFormat to match the behavior
of other browsers.

In MSDN <http://msdn.microsoft.com/en-us/library/aa220275(office.11).aspx>,
RemoveFormat
is described as:

> Removes the font and character formatting from the current selection.

The following code removes all formatting from the selected text.


> ActiveDocument.execCommand "removeformat


In MDC <https://developer.mozilla.org/en/rich-text_editing_in_mozilla>, it's
described as:

> Removes all formatting from the current selection.


However, our current
implementation<http://trac.webkit.org/browser/trunk/WebCore/editing/RemoveFormatCommand.cpp#L49>deletes
all selected contents and type them back in,
losing all sorts of elements such as input, img, hyper links, tables, lists,
and etc...

There are two options to resolve this problem:

   1. Store all elements deleted and their positions and insert (restore)
   them back.
   2. Remove format more gracefully by walking through the DOM and removing
   stylesheets and presentational elements.

I want to re-implement RemoveFormat because I don't think option 1 really is
an option.

Best Regards,
Ryosuke Niwa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100725/2d7f6adf/attachment.html>


More information about the webkit-dev mailing list