Skip to main content

Bug Tracker

Side navigation

#4216 closed bug (fixed)

Opened February 23, 2009 04:03AM UTC

Closed April 22, 2009 05:24AM UTC

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

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" );
	}
Attachments (0)
Change History (4)

Changed March 31, 2009 09:05PM UTC by brandon comment:1

owner: → 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.

Changed April 22, 2009 04:55AM UTC by brandon comment:2

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

Changed April 22, 2009 05:07AM UTC by brandon comment:3

Replying to [comment:1 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.

Changed April 22, 2009 05:24AM UTC by brandon comment:4

resolution: → fixed
status: newclosed

this is now fixed in r6318