[whatwg] Ongoing work on an editing commands (execCommand()) specification

On 11-03-02 2:18 PM, Aryeh Gregor wrote:
>>
>> Styling a Range / Unstyling a Range doesn't seem to split the range into
>> segments of phrasing contents.  How does your algorithm avoid wrapping a
>> non-phrasing element with a span? (e.g. we don't want to wrap div,
>> blockquote, etc... with a span)
>
> I currently avoid this by just not wrapping anything but text nodes.
> This is part of what makes the algorithm horribly messy: bolding
>
>     abc<i>def</i>  <br>  ghi
>
> gives
>
>     <b>abc</b><i style="font-weight: bold">def</i><b>  </b><br
> style="font-weight: bold"><b>  ghi</b>
>
> instead of
>
>     <b>abc<i>def</i>  <br>  ghi</b>
>
> This is clearly not acceptable for a final algorithm.  I plan to work
> on polishing the markup cleanliness later, after I've got all the
> important features more or less working.  Currently I haven't even
> looked at commands as basic as "delete" -- although hopefully a lot of
> my work has been done for me by the research Google published some
> months ago on some of these commands.

I think it's best to address these types of issues sooner in the
specification process rather than later.  A lot of the complexity of
Gecko's implementation in these cases is caused by the desire to
generate simpler DOM structures as much as possible, and the type of
resulting structure would also have an effect on the algorithms
(simple example: the unstyling algorithm needs to handle all those
tricky cases).

--
Ehsan Akhgari
Mozilla Corporation
http://ehsanakhgari.org/

Received on Friday, 18 March 2011 23:07:51 UTC