2013-04-19 5:32 said:
We use <xmp>, a quieter version of <pre>, a lot. However, it's
deprecated. It works great in FF and that's kinda all we care about,
BUT, we want to play ball. What is used instead <xmp> now?
The very first HTML specification, HTML 2.0, said:
"Since CDATA declared content has a number of unfortunate interactions
with processing techniques and tends to be used and implemented
inconsistently, HTML documents should not contain XMP nor LISTING
elements -- the PRE tag is more expressive and more consistently supported."
http://www.w3.org/MarkUp/html-spec/html-spec_5.html#SEC5.5.2.1
The world around has changed in 17 years, but the HTML5 CR still plays
the same game, though it is more explicit:
"xmp
Use pre and code instead, and escape "<" and "&" characters as
"<" and "&" respectively."
http://www.w3.org/TR/html5/obsolete.html#non-conforming-features
In reality, <pre> is not "more expressive" except in the sense that
markup and entities are recognized inside it, which is normally
something people do *not* want when considering the use of <xmp> (unless
they want some color coding). There is no evidence of more consistent
support.
HTML5 spells out the situation, but the reference to <code> should have
the condition "if you would be using <xmp> to present computer code, as
people mostly do".
<xmp> has been frowned upon because at some point, some people, trying
to retrofit the improvised tag soup system called "HTML" into SGML,
started thinking that CDATA declared content wasn't really in the spirit
of SGML. Later, nobody has really defended <xmp> against all the false
accusations or the discrimination based just on its being different.
<xmp> does its job well. It is true that it is anomalous, truly unique
in its nature (if we ignore <plaintext>, which was a real oddity): it is
the only element inside which no markup, not even character and entity
references, is recognized, except for the end tag of the element itself.
And this is exactly why it was invented and why it is used: to present
text without having any markup recognized but treated as plain text.
If you are generating HTML programmatically, it is a peace of cake to
escape "<" and "&". Doing that by hand tends to be error-prone, and the
only reason to bother is that some people may peek into your code and
declare <xmp>, and you, deprecated, obsolete, forbidden, cursed,
anathema, etc. That's often a very real risk - and it makes people look
for <table> as well, or anything that is "not semantic" in their book.