Reanimate <xmp>

Hello!

There is some noise on the list about the revenant <xmp>.
We should bring it back to real life.


HISTORY

The <xmp> element was part of the first HTML standard [1].
It has support of all mayor web browsers [2] back to the early days of the
web. Actual browser support is as described in a footnote of HTML2 [3].

This gives a taste of the discussions 15 years ago [4]:

   >[...] I hope I've misunderstood, if you are proposing to replace
   >XMP with PRE. Another problem with this replacement is
   >the quoting problem. With XMP, you don't need to worry about whether
   >or not your arbitrary text contains something which looks like an HTML
   >tag. This is an important feature, and one which should be kept IMHO.

   [...] Even the XMP semantics are no good. In SGML, the
   string "</" is recognized as markup iff it's followed by a name start
   character (a letter). The above HTML documentation says </ is only
   markup if it's followed by XMP, i.e. "</XMP>" is the _only_ string
   that ends an XMP section. This is not expressible in SGML.

Dan Connolly's arguments are invalid these days, so we should bring back
<xmp> to the standard.


USECASE

1. Clean and convenient replacement for the current <pre><code>
    construct in most cases.
  - Block container for HTML and XML code. Get it by innerHTML and use it [5].
  - Block container for other computer code [6].
2. Container for ASCII art (no need for the artist to care about
    characters like "<" or "&").
3. Im sure, there are more...


ATTRIBUTES

1. LANGUAGE
    If <xmp> contains computer code, an element-specific attribute "LANGUAGE"
    may/should/must specify the code type, eg. by using the MIME-type.
    "It would be a hook for specialised search engines or for specific code
     color rendering displays in UA" [7]

2. ALT
    If <xmp> contains ASCII art, an attribute "ALT" may/should/must
    be specified according to @alt for <img>.
    Furthermore a visual UA with small screen or lack of fixed fonts
    may display the value in place of the element's content.


SEMANTICS

Hmm, overlapping with <pre> should be avoided.
Perhaps somehing like this:
The xmp element represents a block of preformatted text,
which is not expected to be readable literally by humans.


PRO
Very convenient for authors, widely implemented today.

CON
<xmp><![CDATA[   XHTML needs CDATA section.   ]]></xmp>


j.j.


[1]  
<http://www.w3.org/History/19921103-hypertext/hypertext/WWW/MarkUp/Tags.html#8>
[2] An exeption is Opera. Opera3 supports <xmp>, Opera6 doesn't.
     Since Opera7.5 it's back again.
     Futhermore currently Opera ignores <xmp> if the closing tag is missing.
     Opera doesn't handle xmp.innerHTML properly.
[3] <http://www.w3.org/MarkUp/html-spec/html-spec_foot.html#FOOT18>
[4] <http://lists.w3.org/Archives/Public/www-talk/1992NovDec/0121.html>
[5] <http://lists.w3.org/Archives/Public/public-html/2007May/0256.html>
[6] <http://lists.w3.org/Archives/Public/public-html/2007Dec/0114.html>
[7] <http://lists.w3.org/Archives/Public/public-html/2007Dec/0108.html>
Related:
     <http://lists.w3.org/Archives/Public/public-html/2007Aug/0694.html>
     <http://lists.w3.org/Archives/Public/public-html/2007May/0060.html>

Received on Sunday, 9 December 2007 08:03:35 UTC