BKDesign Solutions wrote:

Opinions?
for using js, I heard that it's better to use classes on every item ;

To quote from elsewhere:
"increased specificity makes programming in Javascript easier, e.g. the ability to grab a single element by name instead of parsing through the DOM to grab it."

like to me:
<div class="sidenav">
<h2>Site navigation</h2>
<ul>
<li>List item</li>
etc

Is best rather than adding a class to every item.
<div class="sidenav"> <h2 class="sidetitle... ul class etc etc

Seems to me that nailing every single element isn't required nor good practice.

Bruce P
bkdesign solutions



Quite right, I know the fastest way to get an element is by Id because by definition there's only one in the dom so it can go straight to it. I try and keep class names to a minimum or use them where some extra semantics is handy e.g. microformats and repeated structures and then use Ids to denote the primary page structure and form elements. Works for me anyway.

   Rob

Reply via email to