Re: HTML classes

At 10:45 PM +0300 8/19/04, Charles McCathieNevile wrote:
>For a start I would suggest that they learn about modularising XHTML 
>so they can add a tag in a way that is valid. (Actually I am 
>inclined to say "don't go there", but that might just suggest that I 
>am not an ideal person to be answering the question).

Actually, with a little server-side scripting this can be done by
subclassing in existing HTML/XHTML.

The rough outline that I would suggest, but ask more script-savvy
people to verify, is that Sam _author_ in a dialect in which he uses
'class' marks
http://www.w3.org/TR/html401/struct/global.html#adef-class to
indicate what behavioral class he wants an element to belong to, and
then process the authoring format into the web-delivered format in a
macro-expansion step using Perl, M4,  XSLT or PHP or something like that to

a) add the event-to-handler bindings on these elements as a function
of the class marks
b) add the scripts for the handlers into the page
(once per script, not once per element)
as new requirements for handlers are discovered. Handlers not used
would not be pasted in.

There is work afoot in CSS3 and related areas to use XBL to do the
second step in the client-executed stylesheet processing. But for now
I think it's saner to do that in a server-side script.

There is work afoot in the WAI to explain how to do this with some
level of documentation and standard semantics through RDF annotations
that explain the ontology being used. But that has not yet been
developed to a tutorial level.

Note that the 'class' attribute takes as its value a space-separated
list of tokens. So there may be more than one 'class' mark on an
element. Some people think that 'class' won't be good for capturing
semantic or behavioral information because "the authors are convinced
that is for styling." That argument is bogus. There is always a
semantic reason behind the presentation choices. The 'class' marks
can be in a clean, semantic vocabulary and still tell you what you
need to know (aside from the element type and parse-tree-path to the
element, which are handled separately in selectors) to make all the
stylistic distinctions you need to make.

More on good class use at (and linked from):
http://lists.w3.org/Archives/Public/www-qa/2004Mar/0018.html

Al

>
>chaals
>
>On Thu, 19 Aug 2004 16:04:35 -0400, Samuel Richter <mephtu@yahoo.com> wrote:
>
>>  [Becky, Jim, anybody working on the script techiques -- what 
>>can/should we tell this person?  -Al]
>>-- original thread
>>Archived-At: 
>>http://www.w3.org/mid/20040819193602.74991.qmail@web40409.mail.yahoo.com
>>-- original message starts here
>>  I want to specify a new tag in HTML with certain
>>javascript behaviours and use that tag within my
>>document.
>>Is there any way to do this?
>
>
>
>--
>Charles McCathieNevile         charles@sidar.org
>Fundación Sidar             http://www.sidar.org

Received on Thursday, 19 August 2004 21:28:01 UTC