> In the .css method an array is created by: 
> 
> d = ["Top","Bottom","Right","Left"];
> 
> Then it is looped through using object looping:
> 
> for ( var i in d ) { 
> 
> This probably isn't a problem for most people, but we have 
> added functions to the Array prototype, so whenever the .css 
> method is used it dumps the text of all those functions into 
> the CSS and bloats the code considerably.  I made the 
> following patch and tested it. It seems to work fine: 
> 
> Index: jquery.js
> ===================================================================
> --- jquery.js    (revision 575)
> +++ jquery.js    (working copy)
> @@ -1472,7 +1472,7 @@
>          if ( p == "height" || p == "width" ) { 
>              var old = {}, oHeight, oWidth, d =
["Top","Bottom","Right","Left"];
>  
> -            for ( var i in d ) {
> +            for ( var i = 0; i < d.length; i++ ) {
>                  old["padding" + d[i]] = 0;
>                  old["border" + d[i] + "Width"] = 0;
>              }

Yeah, I noticed that a while ago too. I was going to commit a fix but never
have had much luck with svn on jquery.com.

I like doing it this way, but either one would work the same:

        if ( p == "height" || p == "width" ) { 
            var old = {}, oHeight, oWidth, d = { Top:1, Bottom:1, Right:1,
Left:1 };

            for ( var w in d ) {
                 old["padding" + w] = 0;
                 old["border" + w + "Width"] = 0;
             }

-Mike


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to