Skip to main content

Search and Top Navigation

#9533 closed bug (fixed)

Opened September 04, 2013 11:19PM UTC

Closed January 15, 2014 10:18AM UTC

Last modified January 15, 2014 10:19AM UTC

Position: positioning within document raises error

Reported by: meyertee Owned by: meyertee
Priority: minor Milestone: 1.10.4
Component: ui.position Version: 1.10.3
Keywords: Cc:
Blocked by: Blocking:

jQuery raises an error when trying to position an element within the document:

$( "#elx" ).position({
	my: "left top",
	at: "right bottom",
	of: "#parent",
	within : document

The reason is that jquery-ui tries to access '$(document).css( "overflow-x" )' which causes an error in jQuery. Maybe that's a bug in jQuery itself, not sure if it's legal to access css of document. Either way I created a fix for it in jquery-ui.

Pull request will follow shortly.

The underlying reason in jQuery is that it tries to map the style property in the 'css' function to a vendor prefixed property in this line, causing the error in the 'vendorPropName' function:

// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName(, origName ) );

Because the vendor-prefixed names are cached, the error does not occur when the style-prop "overflow-x" is used on another element earlier, which makes the bug especially hard to catch!

Attachments (0)
Change History (8)

Changed September 05, 2013 01:15AM UTC by meyertee comment:1

Changed September 06, 2013 11:54AM UTC by tj.vantoll comment:2

owner: → meyertee
status: newpending

Hi meyertee,

Thanks for taking the time to contribute to the jQuery UI project. I'm not seeing the error you're describing -

seems to work fine:

Could you please alter my test case to show the error you're seeing?


Changed September 06, 2013 12:12PM UTC by meyertee comment:3

status: pendingnew

Thanks for looking into it!

The culprit is "within:document":

Changed September 06, 2013 12:16PM UTC by meyertee comment:4

Sorry for the status-change to "new", but I can't deselect "leave as new" when submitting a comment...

Changed September 06, 2013 12:25PM UTC by tj.vantoll comment:5

status: newopen

Ah ok, this seems like a legit request to me as we accept

most other places.

Changed January 15, 2014 10:18AM UTC by Thomas Meyer comment:6

resolution: → fixed
status: openclosed

Position: Avoid reading overflow css on documents

Fixes #9533

Closes gh-1072

Changeset: 1bbbcc723c489d7ef7d72bb62564b8f07805c41c

Changed January 15, 2014 10:19AM UTC by Thomas Meyer comment:7

Position: Avoid reading overflow css on documents

Fixes #9533

Closes gh-1072

(cherry picked from commit 1bbbcc723c489d7ef7d72bb62564b8f07805c41c)

Changeset: c8b264006d2fd8d9c27cfa8aef619428c563cb80

Changed January 15, 2014 10:19AM UTC by scottgonzalez comment:8

milestone: none1.10.4