state management plug-in idea

Colin Clark colin.clark at
Thu Aug 14 21:51:46 UTC 2008


Good suggestion. This was pretty much what I was trying to get at last  
week during our conversation on the subject of states and CSS:

On 14-Aug-08, at 2:20 PM, Eli Cochran wrote:
> What if we had a state plugin (jQuery of course) that allowed us to  
> say $(elm).state('disabled'); that would set all three for us in one  
> shot?

I think I'd probably factor it differently, so that is more action- 
based, can be reversed, and won't require a string-based parameter.  
But otherwise, the same line of thinking:


...or something along these lines. One of the things I dislike about  
the jQuery plugin model is the lack of namespacing. Your functions get  
mixed in alongside everyone else's functions, so there's a high  
possibility of collision for common terms like "disable."

So perhaps a namespace like this might be wise:


> Obviously this would have to be driven by some large data object  
> that contained information about which elements get which  
> attributes, and which matching class, and allow for custom states  
> and classes, and some logic for when states are applied, removed,  
> changed, etc.

This is where the real work would come in, but I think it could  
probably be done fairly easily by someone who felt like developing an  
intimate familiarity with the HTML spec. Certainly the jQuery plugin  
part is trivial, it's just a matter of capturing all the rules for  
specific elements.


Colin Clark
Technical Lead, Fluid Project
Adaptive Technology Resource Centre, University of Toronto

More information about the fluid-work mailing list