Shelvacu
Shelvacu

Reputation: 4362

What did the non-standard html <comment> tag do?

So I was reading a blog that mentioned

IE8 and below also support the (non-standard) <comment> tag.

This is <comment>not</comment> IE.

What is the <comment> tag supposed to do? I've tried searching for things like "html comment tag" but all I get is information about about the <!-- --> syntax.

Upvotes: 2

Views: 64

Answers (2)

Lance Leonard
Lance Leonard

Reputation: 3285

This 2002 Usenet thread provides a nice discussion of the comment element's history. Most relevant:

Oh, how quickly they forget. The COMMENT element was created by... Tim Berners-Lee. Or mabye Dan Connolly. The point is, it existed in an early version of HTML (back before they were making formal DTDs), and was quietly dropped when the W3C crew realized the COMMENT element was bad SGML.

The closest to an "official word" can be found in the 1993 version of what we now call the HTML standard:

Status: Obsolete

A comment element used for bracketing off unneed text and comment has been introduced in some browsers but will be replaced by the SGML command feature in new implementations.

Hope this helps...

-- Lance

Upvotes: 3

BoltClock
BoltClock

Reputation: 723729

As far as I can tell it was functionally similar to <!-- --> comments in that text contained within it was hidden from the browser (in this case, IE). According to MSDN:

The COMMENT element is treated as a no-scope element and does not expose any children.

The key difference is that the <comment> element supported a data attribute pointing to a URL, supposedly with information that was related to the comment text, not unlike the cite attribute of <blockquote> and <q> that points to the source of a quotation. In HTML, <!-- --> comments don't have any built-in metadata whatsoever; they are nothing more than arbitrary strings that are ignored by the parser.

Upvotes: 3

Related Questions