Bug Tracker

Ticket #1424 (closed bug: fixed)

Opened 1 year ago

Last modified 1 year ago

Correction of height and width methods

Reported by: hobbit Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.2 Component: core
Version: 1.1.3 Keywords: height, width
Cc: Needs: Review

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

Change History

Changed 1 year ago by brandon

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.1.4 to 1.2.2

This works for me with jQuery 1.2.1

Note: See TracTickets for help on using tickets.