W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2011

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

From: Markus Ernst <derernst@gmx.ch>
Date: Sun, 13 Mar 2011 22:20:36 +0100
Message-ID: <4D7D3524.4050901@gmx.ch>
Am 13.03.2011 21:46 schrieb Aryeh Gregor:

> 2) How much work should we go to to produce nice-looking markup?
> E.g., if the user unbolds "baz" in
> <div style="font-weight:bold">
> <p>Foo
> <p>Bar baz
> </div>
> should we produce something like
> <div>
> <p style="font-weight: bold">Foo
> <p><b>Bar</b>baz
> </div>
> like WebKit does, or would it be okay to do
> <div style="font-weight:bold">
> <p>Foo
> <p>Bar<span style="font-weight: normal">baz</span>
> </div>
> to avoid the complexity, given that this sort of markup shouldn't be
> too common?  I think it's clear that something like "<b>Foo baz
> bar</b>" should become"<b>Foo</b>baz<b>  bar</b>" and not"<b>Foo
> <span style='font-weight: normal'>baz</span>  bar</b>", but how far
> should we go?

IMO, from the moment you decide to use <b> and not style="bold" (be it 
due to a user selectable mode or not), style="bold" should actually be 
totally avoided. Thus, the CSS bolding in your example should be 
replaced by <b> tags:

<p><b>Bar</b> baz

I think that the code generated should be homogeneous, independent from 
the original markup (which may be copy-/pasted from various sources). 
That means, the bolding in your example would be changed to <b> already 
when the contenteditable element is built, or when the fragment is 
pasted in.
Received on Sunday, 13 March 2011 14:20:36 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:31 UTC