[whatwg] Request for feedback: supported elements for formatBlock

On Mon, May 23, 2011 at 2:37 PM, Aryeh Gregor <Simetrical+w3c at gmail.com>wrote:
>
> * Everyone supports address, div, h*, p, pre
> * Everyone but IE supports blockquote
> * Everyone but Opera supports dd, dt
> * Only IE supports ol, ul
> * Only Firefox and Chrome support dl
> * Only Chrome supports article, aside, footer, header, hgroup, nav, section
> * HTML5 mandates support for address, article, aside, blockquote, div,
> footer, h*, header, hgroup, nav, p, pre, section (which is the same as
> Chrome but minus dl/dt/dd)
>

WebKit's FormatBlock basically supports all HTML5 elements that are display:
block by default.

The issue with all the non-IE browsers is that they support a bunch of
> things that make sense to nest within one another, and formatBlock
> doesn't work for nesting.  So for instance, if I do
> execCommand("formatBlock", false, "blockquote") on
> <p>foo</p><p>bar</p>, what's the result?  Firefox produces
> <blockquote><p>foo</p><p>bar</p></blockquote>, Chrome produces
> <blockquote>foo<br>bar</blockquote>, and Opera produces
> <blockquote>foo</blockquote><blockquote>bar</blockquote>.
>

I think Chrome's and Opera's behaviors make most senes here given that
FormatBlock removes the current enclosing block and replace it with the
specified block in other situations.

If you argue that blockquote can be nested, then I'd argue that any block
elements except p can be nested in various situations.

If formatBlock supported them in the way Firefox supports blockquote, you
> could add them using execCommand() but not remove them.
>

For this reason, I don't like Firefox's behavior.

As for Chrome or Opera, their way of doing things might make sense in
> some cases for blockquote, but usually you want the way indent behaves
> instead.  If I select two paragraphs and want to put a blockquote
> around them, normally I want a two-paragraph blockquote, not a
> two-line blockquote or two blockquotes.  It doesn't make any sense at
> all for things like article -- you want
> <article><p>foo</p><p>bar</p></article>, not
> <article>foo<br>bar</article> and certainly not
> <article>foo</article><article>bar</article>.
>

I disagree.  It depends on context.

So my current spec
> <
> http://aryeh.name/gitweb.cgi?p=editcommands;a=blob_plain;f=editcommands.html;hb=4a898d7#the-formatblock-command
> >
> supports only address, div, h*, p, and pre.  I don't think it makes
> sense to support things like blockquote (or article, aside, etc.)
> which are expected to have other block elements nested inside them.

Those should have separate commands (as should dl/dt/dd, probably).
> But if anyone else feels otherwise, please say so.
>

I think we have to support blockquote.  The last time I checked, Gmail used
FormatBlock to add blockquote around the quoted context.

- Ryosuke

Received on Wednesday, 25 May 2011 22:56:08 UTC