Class name or custom attribute

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Class name or custom attribute

Post by superdezign »

I'm writing a JavaScript class to generate different effects. I've hit a dilemma as to how to identify objects that the effects will take place on.

One way that I am considering is placing the effects into element definitions. However, I don't know whether to put it into a class name or create a custom attribute. i.e.

Code: Select all

<!-- Generate a shadow at an angle of 45 degrees -->
<p class="vol shadow(45)">Text</p>
<p effect="shadow(45)">Text</p>
The first is valid markup, but may cause difficulty with adding class name. It requires that one of the classes be 'vol' before parsing the name is considered, and the effects must be given parameters. I've thought it through, at least.
The second is invalid markup, but gets straight to the point. I'm not sure if I'd want to use invalid mark up though.

Then there's the option of simply doing it all manually.


Which would you recommend?
Post Reply