On 12/12/05 01:15, Lachlan Cannon wrote:
Using classes it's not clear if it's there to style an element or to pass params to some js widget or whatever. When using custom attrs it's much clearer what's going on.

I couldn't disagree more. :)

class is there to 'subclass' elements. The W3C themselves say <http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.2>:

"""The class attribute, on the other hand, assigns one or more class names to an element; the element may be said to belong to these classes. A class name may be shared by several element instances. The class attribute has several roles in HTML:

* As a style sheet selector (when an author wishes to assign style information to a set of elements).
     * For general purpose processing by user agents."""

This is exactly one of the reasons it's there for! Why go looking at (relatively) complicated things like namespaces when class works fine?

Point taken.

We once had to rebuild an existing rather complex site and I spend hours scanning through stylesheets fiddling out where which class was defined and what it's supposed to do.

After that experience I started using custom attrs for anything behaviour related.

Anyway, /me go's and rereads the w3c specs ... :)

Reply via email to