Skip to main content

Bug Tracker

Side navigation

#1424 closed bug (fixed)

Opened July 26, 2007 01:04PM UTC

Closed September 27, 2007 06:46PM UTC

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:
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 );
  };
});

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.

Attachments (0)
Change History (1)

Changed September 27, 2007 06:46PM UTC by brandon comment:1

milestone: 1.1.41.2.2
resolution: → fixed
status: newclosed

This works for me with jQuery 1.2.1