Skip to main content

Search and Top Navigation

#7766 closed bug (fixed)

Opened October 06, 2011 04:52AM UTC

Closed November 05, 2015 04:44PM UTC

Last modified November 05, 2015 04:45PM UTC

Resizable: Using invalid jQuery css parameter

Reported by: urkle Owned by:
Priority: minor Milestone: 1.12.0
Component: ui.resizable Version: 1.8
Keywords: Cc:
Blocked by: Blocking:
Description

In jquery.ui.resizale.js (against master) line 839 is the following.

avoid IE jump (hard set the margin)

this.originalElement.css({ margin: this.originalElement.css('margin') });

Using .css('margin') is not supported by jquery (according to http:api.jquery.com/css/)

"Shorthand CSS properties (e.g. margin, background, border) are not supported. For example, if you want to retrieve the rendered margin, use: $(elem).css('marginTop') and $(elem).css('marginRight'), and so on."

From my testing of another widget we are using which was incorrectly doing this as well it was causing thrown errors of "invalid argument" when fetching the margin for an input element containing the following margn

"0 0 1px 0".

This can be seen with this fiddle.. in IE 7 and IE 8.

http://jsfiddle.net/cCGeW/5/embedded/result/

The solution is to use the individual marginLeft, marginTop, etc..

Attachments (0)
Change History (6)

Changed June 14, 2012 04:52PM UTC by scottgonzalez comment:1

version: git1.8

This is not something that has changed.

Changed October 11, 2012 02:52PM UTC by scottgonzalez comment:2

milestone: 1.9.02.0.0

Changed October 25, 2012 05:53PM UTC by tj.vantoll comment:3

summary: ui.resizable using invalid jquery css parameterResizable: Using invalid jQuery css parameter

The attached fiddle no longer produces an error in IE <= 9 as of jQuery 1.7.2 (http://jsfiddle.net/tj_vantoll/9ZRx8/). I believe this was the fix in question https://github.com/jquery/jquery/commit/6aa4095ed62.

That being said the referenced shorthand property is still used in the code (https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.resizable.js#L85).

Changed October 25, 2012 05:57PM UTC by mikesherov comment:4

status: newopen

Yeah, this is open, because retrieving shorthand properties is not supported. http://api.jquery.com/css/

"Shorthand CSS properties (e.g. margin, background, border) are not supported. For example, if you want to retrieve the rendered margin, use: $(elem).css('marginTop') and $(elem).css('marginRight'), and so on."

Changed November 05, 2015 04:44PM UTC by Scott González comment:5

resolution: → fixed
status: openclosed

Resizable: Don't use CSS shorthand properties with .css()

Fixes #7766

Closes gh-1644

Changeset: 6a681c2c13afb6e76a6881b9dae928b9ff66a395

Changed November 05, 2015 04:45PM UTC by scottgonzalez comment:6

milestone: 2.0.01.12.0