Opened 6 years ago

Closed 18 months ago

Last modified 18 months ago

#7766 closed bug (fixed)

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..

Change History (6)

comment:1 Changed 5 years ago by Scott González

Version: git1.8

This is not something that has changed.

comment:2 Changed 5 years ago by Scott González

Milestone: 1.9.02.0.0

comment:3 Changed 4 years ago by tj.vantoll

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).

comment:4 Changed 4 years ago by mikesherov

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."

comment:5 Changed 18 months ago by Scott González

Resolution: fixed
Status: openclosed

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

Fixes #7766 Closes gh-1644

Changeset: 6a681c2c13afb6e76a6881b9dae928b9ff66a395

comment:6 Changed 18 months ago by Scott González

Milestone: 2.0.01.12.0
Note: See TracTickets for help on using tickets.