Bug Tracker

Ticket #4216 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

css function does not handle negative width and height in key/value pairs

Reported by: Simon_Francesco Owned by: brandon
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by brandon) (diff)

While the css function correctly handles a single property or height that is passed with a negative value it does not handle multiple key/value pairs. Existing code:

css: function( key, value ) {
		// ignore negative width and height values
		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
			value = undefined;
		return this.attr( key, value, "curCSS" );
	}
Suggested change:
css: function( key, value ) {
		// ignore negative width and height values
		if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
			value = undefined;
                if(typeof(key.height)!==undefined && parseFloat(key.height) < 0)key.height = undefined;
                if(typeof(key.width)!==undefined && parseFloat(key.width) < 0)key.width = undefined;
		return this.attr( key, value, "curCSS" );
	}

Change History

comment:1 follow-up: ↓ 3 Changed 5 years ago by brandon

  • Owner set to brandon

See #4295 ...

I believe the proper approach here is to use a space separated (instead of an array) string that is similar to other places we do multiple values-like calls.

comment:2 Changed 5 years ago by brandon

  • Description modified (diff)

comment:3 in reply to: ↑ 1 Changed 5 years ago by brandon

Replying to brandon:

See #4295 ...

I believe the proper approach here is to use a space separated (instead of an array) string that is similar to other places we do multiple values-like calls.

Not sure why I made this comment... must have been in the wrong tab and not paying close enough attention.

comment:4 Changed 5 years ago by brandon

  • Status changed from new to closed
  • Resolution set to fixed

this is now fixed in r6318

Note: See TracTickets for help on using tickets.