W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2008

[whatwg] <ins>, <del>, and <mark> crossing element boundaries

From: Matthew Paul Thomas <mpt@myrealbox.com>
Date: Wed, 02 Apr 2008 23:06:51 +1300
Message-ID: <47F35ABB.8090800@myrealbox.com>
Keryx Web wrote on 26/03/08 08:44:
> This is from Thomas Thomassen on WSG's list:
> ------------
> As I was working on this I wanted to mark up a list where items had
> been added and removed. That's when I realised that you can't wrap up
> <li> <dt> or <dd> in <del> or <ins> elements because <ul>, <ol> and
> <dl> only allows list items as their direct child.

Oh, but it's even worse than that. :-)

<ins>, <del>, and <mark> are the three cases I can think of where the
appropriate content model could be described as "roughshod" -- there's
no logical reason (other than ease of implementation) for any of them to
fit neatly inside the element hierarchy of the rest of the document.

For example, a couple of lines of an ancient poem might be interpolated
by an editor where insects had eaten away at the original manuscript,
and those insects had paid no attention to the HTML element hierarchy:


Similarly an editor might insert extra sentences into the middle of a
paragraph, and therefore split the paragraph in two to prevent it being
over-long: <p>...<ins>...</p><p>...</ins>...</p>.

Conversely, she might remove text from two adjacent paragraphs, and
therefore collapse them into a single paragraph:

And a highlighted portion of an essay or article can easily include
multiple paragraphs, and/or a whole paragraph plus part of an adjacent
paragraph. <p>...<mark>...</p><p>...</p><p>...</p></mark>

The real-world things that the <ins>, <del>, and <mark> elements
represent can all cross element boundaries at will, just like the text
selection in a Web browser can. But with the current (and all previous)
content models for these elements, those effects need to be faked using
multiple elements.

I don't know what use this observation is. Maybe it means <ins>, <del>,
and <mark> shouldn't be HTML elements, but should be something else instead.

Matthew Paul Thomas
Received on Wednesday, 2 April 2008 03:06:51 UTC

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