wow. That's rocking. The only trick would be to build a list of possible attributes that I cared about and that's all. Wow. Good job.
<div><span class="gmail_quote">On 12/15/06, <b class="gmail_sendername">Luke Lutman
</b> <<a href="mailto:luke@zincroe.com">
luke@zincroe.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I had to do something similar recently. What I did was overload the css and curCSS functions in
jQuery to accept an array (of css property names), and return an object whose toString method
builds the inline css string.
For example:
$('#single').css('font-size'); -> "12px"
$('multi').css(['font-size','line-height']).toString(); -> "font-size: 12px; line-height: normal";
I've packaged it up as a (not very thoroughly tested) plugin here:
<a href="http://jquery.lukelutman.com/plugins/css/">
http://jquery.lukelutman.com/plugins/css/</a><a href="http://jquery.lukelutman.com/plugins/css/jquery.css.js">
http://jquery.lukelutman.com/plugins/css/jquery.css.js</a>Cheers,
Luke
Yehuda Katz wrote:
> I'm looking for some help in building a plugin that would get the
> computed styles of an element and build an inline style string for that
> element. I assume it'd be something like looping through
> jQuery(el).css("styleName") and sticking the results together.
>
> Any more specific ideas?
>
> --
> Yehuda Katz
> Web Developer | Wycats Designs
> (ph) 718.877.1325
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> jQuery mailing list
> <a href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
> <a href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a>--
zinc Roe Design
<a href="http://www.zincroe.com">
www.zincroe.com</a>
(647) 477-6016
_______________________________________________
jQuery mailing list
<a href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
<a href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a>
</blockquote></div>
<br clear="all">
--
Yehuda Katz
Web Developer | Wycats Designs
(ph) 718.877.1325
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/