#9533 closed bug (fixed)
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: |
Description
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( elem.style, 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!
Change History (8)
comment:1 Changed 9 years ago by
comment:2 Changed 9 years ago by
Owner: | set to meyertee |
---|---|
Status: | new → pending |
Hi meyertee,
Thanks for taking the time to contribute to the jQuery UI project. I'm not seeing the error you're describing - document
seems to work fine: http://jsfiddle.net/tj_vantoll/cwEpz/.
Could you please alter my test case to show the error you're seeing?
Thanks.
comment:3 Changed 9 years ago by
Status: | pending → new |
---|
Thanks for looking into it! The culprit is "within:document": http://jsfiddle.net/meyertee/cwEpz/5/
comment:4 Changed 9 years ago by
Sorry for the status-change to "new", but I can't deselect "leave as new" when submitting a comment...
comment:5 Changed 9 years ago by
Status: | new → open |
---|
Ah ok, this seems like a legit request to me as we accept document
most other places.
comment:6 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Position: Avoid reading overflow css on documents
Fixes #9533 Closes gh-1072
Changeset: 1bbbcc723c489d7ef7d72bb62564b8f07805c41c
comment:7 Changed 9 years ago by
Position: Avoid reading overflow css on documents
Fixes #9533 Closes gh-1072 (cherry picked from commit 1bbbcc723c489d7ef7d72bb62564b8f07805c41c)
Changeset: c8b264006d2fd8d9c27cfa8aef619428c563cb80
comment:8 Changed 9 years ago by
Milestone: | none → 1.10.4 |
---|
Created a pull request: https://github.com/jquery/jquery-ui/pull/1072