He's  talking  about  dynamically  adding  classes to stylesheets, not
adding existing classes to elements.

My long-view recommendation is to point to a per-session stylesheet in
your  markup  (give  it  a  very  long  cache lifetime, so it's not an
appreciable bandwidth hit) that starts out empty on the server, rather
than instantiating the STYLE element yourself.

For your initial rollout, add your rules to the stylesheet at runtime,
understanding  you'll  be discarding them on every new page view. This
gives  you a good migration path for the next step: persisting session
styles  onto  the server, so you don't have to re-add rules unless you
get  an  onresize  or  a  new  session.  (Or  you  can use client-side
persistence methods if you want.)

A great guide to the technicals is here:

    http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript

-- Sandy

Reply via email to