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

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:

<p>
  ...<br>
  ...<br>
  ...<br>
  <ins>...
</p>
<p>
  ...<br></ins>
  ...<br>
  ...<br>
  ...
</p>

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:
<p>...<del>...</p><p>...</del>...</p>.

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
http://mpt.net.nz/

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