Modify ↓
Ticket #4216 (closed bug: fixed)
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" );
}
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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.