[Javascript] Javascript arrays

Paul Novitski paul at novitskisoftware.com
Thu May 6 14:01:10 CDT 2004


At 11:42 AM 5/6/2004, Chris T wrote:
>you could do 4 classes:  cssEnSel, cssEnDes, cssDiSel, cssDiDes
>but with 2^n classes for each object (n=variable properties) the style sheet
>will be longer than
>the html document.


Again, there's no need to fret over 2^N classes, because you can assign 
more than one class to an object.  You handle the overlapping of classes on 
the HTML/DOM side, not the CSS side.

In the case of overlapping state pairs such as Enabled/Disabled and 
Selected/Deselected, all you need minimally are:

- one default style that combines all the "off" states
- one style for each "on" state

For state-pairs, this is N+1, not 2^N.

If you want to throw tristates and other multiple-state groups into the 
mix, the formula clarifies to:

         classes needed = total_states - total_state_groups + 1

Cheers,
Paul


At 11:42 AM 5/6/2004, Chris T wrote:
>you could do 4 classes:  cssEnSel, cssEnDes, cssDiSel, cssDiDes
>but with 2^n classes for each object (n=variable properties) the style sheet
>will be longer than
>the html document.
>
>======================
>
>How many objects are you working with? If you're dealing with too many, then
>it's possible you need to rethink your logic on which objects actually need
>independent styles.
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript





More information about the Javascript mailing list