At work when I was writing my own JavaScript framework (partly inspired 
in API by jQuery) I ran into a number of times where I needed to grab a 
series of css values and set them all onto another, as a result I ended 
up coming up with another type of input to .css;

$(someNode).css(['backgroundColor', 'backgroundImage', 'width', 'height', 
'position', 'top', 'left']);

Basically I made .css accept a single array of property names to grab. 
The return is a object with property keys and values set on them. The 
absolute beauty of this, was that you could take that same object and 
set it onto another note, or even use it to revert.

var cssCache = $(node).css(['display', 'width', 'height']);
// Do a bunch of stuff to node that modifies all that kind of css.
$(node).css(cssCache); // Revert to the original values


Though I do take note now, another possibility which might fit in better 
with .addClass and .bind might be something like.

$(someNode).css('backgroundColor backgroundImage width height position top 
left');

Though the fact that the difference between 'width' and 'width height' 
is the difference between .css returning a string or an array, so it 
might be worth it to use the array input format to avoid confusion.

Any thoughts? This worth opening an enhancement ticket?

-- 
~Daniel Friesen (Dantman, Nadir-Seen-Fire)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to