Modify ↓
Ticket #1424 (closed bug: fixed)
Correction of height and width methods
| Reported by: | hobbit | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.2.2 |
| Component: | core | Version: | 1.1.3 |
| Keywords: | height, width | Cc: | |
| Blocking: | Blocked by: |
Description
jQuery.each( [ "height", "width" ], function(i,n){
jQuery.fn[ n ] = function(h) {
return h || h===0?
this.css( n, isNaN(h)? h : h + "px" ):
( this.length ? jQuery.css( this[0], n ) : null );
};
});
| h===0) checking works right with undefined, null and NaN values. The original checking was h==undefined. Example the IE doesn't work correct with NaN value. |
And if the h parameter is a string, but doesn't closed with "px" string, then isNaN checking is right.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This works for me with jQuery 1.2.1