RE: naming custom/extended tags

Michael Blow trolled:
> Are there any W3C recommendations on how to name a custom 
> tag?  We need to define a few custom tags, and want to following
> any naming standards that may be in place, to minimize potential
> conflict.

This is going to be a controversial question.  My opinion follows.

HTML wasn't meant to be extended in this way.  So whatever you do,
you might have conflicts later.  XML has a feature (XML Namespaces -
http://www.w3.org/TR/REC-xml-names) that eliminates the problem.
So you should use XML, rather than traditional HTML, if you can.

You've probably heard:  the gurus are now recommending that you use
XHTML rather than HTML anyway.

XHTML 1.0 is the current W3C Recommendation
http://www.w3.org/MarkUp/

If you just can't do XML, for whatever reason, then you're stuck with
hacking traditional HTML (or "Tag Soup" is it is called in this venue.)
The best thing you can do is pick a prefix and stick to it.  The prefix
should be a few letters (or whatever) followed by a colon or hyphen.
So if your product is called the Greyhound Media Blaster, then you have:

  <gmb-video ... >
  <gmb-noise ... >
  <gmb-odor  ... >

The attributes should not have the same prefix, so:

  <gmb-odor scent="#cceecc">      <!-- good -->
  <gmb-odor gmb-scent="#cceecc">  <!-- bad! -->

But if you add an attribute to an existing HTML element, you *should*
put the prefix there, to make it clear that your attribute is not an
HTML attribute (and to avoid conflicts with future HTML features):

  <img src="blat.gif" gmb-scent="#cceecc">  <!-- good -->
  <img src="blat.gif" scent="#cceecc">      <!-- bad! -->

Again, I must emphasize that XML is a better way to go, contingent
upon your business needs.  The main question is: will your users be
exposed to your "custom tags" directly?  And if so: can *they* handle
XML?

-- 
Jason Orendorff
W3C fan, web pundit

Received on Friday, 11 February 2000 18:13:03 UTC