Bug Tracker

Opened 16 years ago

Closed 16 years ago

#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:
Blocked by: Blocking:


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 );
The (h
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 (1)

comment:1 Changed 16 years ago by brandon

Resolution: fixed
Status: newclosed

This works for me with jQuery 1.2.1

Note: See TracTickets for help on using tickets.