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

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

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Thu, 3 Mar 2011 17:22:49 -0500
Message-ID: <AANLkTimUiWuxC+JP6tn4kMsegtbOUdJcP2TbLis=-XpB@mail.gmail.com>
On Thu, Mar 3, 2011 at 4:03 PM, Brett Zamir <brettz9 at yahoo.com> wrote:
> Since span is meant to be a generic container with no inherent meaning or
> formatting of its own (except being understood as being of inline display),
> formatting a span without reference to class would be a pretty broad stroke
> to paint, whereas styling an <i> (or <em>) would be reasonably targeted.

Perhaps, but both are likely to be very rare, especially where
execCommand is typically used.  I don't think this is enough of a
justification for all the complexity of styleWithCSS unless you can
find specific real-world cases where it would cause significant
problems.

> I think the nicest solution would be <span
> class="italic" style="font-style:italic;">, but I don't know that the need
> to export contents for external style usage is one worth complicating the
> markup even further for everyone using it.

I'm pretty sure it's not.

> Personally, I'm not sure why there needs to be the redundant API with
> insertHTML in the first place, if insertHTML can be standardized (maybe with
> a removeHTML to target specific inserted tags?), so I don't see a need for
> adding the semantic ones on top of that.

insertHTML just overwrites the entire selection with the given HTML,
deleting its contents.  You can't reliably use it to wrap text in an
inline element, unless you write all the extremely complicated logic
to do so yourself, in which case you may as well skip execCommand()
and use DOM methods.

> In relation to <strong>, . . .

I'm definitely not going to have "bold" create <strong>.  It will
create either (most likely) <b>, or (less likely) font-weight: bold.

> (The reason to use span over <b>, on
> the other hand, is simply to avoid the tag being at least semantically
> unamenable to alteration by the designer given its always being assumed to
> be tied to boldness by its use of "b". )

Can you give a specific case where this might be a problem?  If you're
already altering the document, I'm having trouble seeing how it would
be harder to alter <b> than <span style="font-weight: bold">.
Altering the first seems much easier, since you can grab it with
getElementsByTagName() and so on, without having to delve into CSS.
Received on Thursday, 3 March 2011 14:22:49 UTC

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