HTML and CSS Reference
In-Depth Information
a computing system, and user input, respectively. Since there is nothing new to report
here, we will move along.
Marking text edits: ins and del
Sometimes it is useful to be able to indicate the edits that have occurred in a document,
for instance, indicating what content has been added and what content has been deleted.
For example, the administration area on a blog will have an area to create and edit posts.
It can be useful to mark up and view the revisions to a blog post indicating what has
changed from the original. HTML5 has just the elements for this purpose! The ins ele-
ment is for marking the insertion of a piece of text, while the del element is used to
mark a deletion. The important point here is that it is marking the content as edited, but
the content would be expected to still be present (in the case of content marked removed
with del ).
JavaScript guru John Resig has an example script that uses ins and del to show
the changes to an edited piece of text. You may view the example at ht-
tp://ejohn.org/projects/javascript-diff-algorithm/ .
Note Without further styling, the default appearance of ins text is usually under-
lined, while del is displayed with a strike-through. This means del will look like s
by default; however, they certainly are not interchangeable. s is for marking inaccurate
content, whereas del is for marking deleted content, regardless of whether it is accur-
ate.
ins and del have two attributes, cite and datetime . The cite attribute is for
specifying the web address of a document that explains the edit, while the datetime
attribute is used to indicate the date and optionally the time the edit occurred. Refer to
the time element earlier in this chapter for the formatting of this value, but it would look
similar to this:
<p>
<ins datetime="2011-10-26T12:00Z"
cite="edit10262011.html">new text</ins> is added, while
<del datetime="2011-10-27T12:30Z"
cite="edit10272011.html">old text</del> is removed.
</p>
Search WWH ::




Custom Search