Class name or custom attribute
Posted: Tue Jul 03, 2007 6:51 pm
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.
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?
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 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?