I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft’s official opinion of the spec. Subsections not listed below were read without comment.
Currently reading in 4.6 Edits
All the sections I read today were non-normative and apply to yesterday’s reading.
4.6.4 Edits and paragraphs
This is sort of a refresher from yesterday’s reading, but because having
del elements cross paragraphs (marked up with
p tags or implied) is hella confusing, you shouldn’t do that. Mark up each paragraph with
p tags, and apply
del elements as they make sense. Whole paragraph was added or deleted? Put the
p tag inside the edit element. Just a part of the paragraph? Put the edit element inside the
4.6.5 Edits and lists
You can’t wrap a list item (
li) with an edit element because only list items are allowed as direct elemental children of
You can, however, wrap the contents of an
li with an
If you wanted to show than a list item had been delete and replaced by another, you can use one
li, with its direct descendants being a
del tag followed by an
ins tag. You COULD also use two
li elements, with an
del child respectively, but note that they’ll still count as 2 list items instead of one, which might have unwanted effects on scripts that spit out the number of list items, or numbering on
ol elements. You could always use attributes to change the number on a list item, but this could become unmanageable.
4.6.6 Edits and tables
Content models for table elements can be tricky. There’s actually quite a lot under the hood for something that seems so antiquated as tables (they are obviously still relevant for tabular content, mostly speaking to their previous use as hacks for layout, and the stigma that carries).
So if you want to use
del in tables, you have to do some things that might seem a bit annoying. To show that a whole row or column has been added or removed, you have to wrap the contents of each cell in a
del element. You can’t really show history of how cells have been shuffled around the table. Styling these entire rows/columns additions and deletions the way you want might require the use of classes, depending on the design.
And that’s the end of Chapter 4.6, a shorter chunk of the HTML spec.