Opened 12 years ago
Closed 12 years ago
#8903 closed bug (worksforme)
outerWidth(true) Causes Window location to jump to top of window in Chrome
Reported by: | anonymous | Owned by: | anonymous |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | dimensions | Version: | 1.5.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: | #4872 |
Description
After upgrading to jQuery 1.5.2, calling $("#appWrap").outerWidth(true) causes the page location to jump to the top of the page. I'm unable to reproduce a broken down test case, but it only occurs on a specific wrapping div around the whole page.
Downgrading to jQuery 1.5.1 fixes the issue, as does downgrading to jQuery 1.4.4. I can also reproduce the issue when calling "$("#appWrap").outerWidth(true);" inside of the console and outside of my code.
This issue only happens in Chrome 10 that I've been able to reproduce.
Change History (13)
comment:1 Changed 12 years ago by
Component: | unfiled → dimensions |
---|---|
Owner: | set to anonymous |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 12 years ago by
I was able to reduce the problem down. It appears that having a form with a text/search input with the autofocus attribute as a child (or descendant?) of the container being evaluated with outerWidth(true) will trigger the jump.
The reduced test case is here: http://jsfiddle.net/wGY6P/show/
comment:3 follow-up: 5 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
That actually makes sense. Focusing on the element brings it into view. This is default browser behavior.
comment:4 Changed 12 years ago by
I understand the purpose of the autofocus attribute.
What I dont' understand is why after the page loads and autofocus has been set and I've focused onto different inputs does focus get set AGAIN onto the input when calling $("#test").outerWidth(true).
To be sure this isn't autofocus, do the following:
#1 Let example execute: http://jsfiddle.net/wGY6P/show/ #2 Scroll to bottom of example #3 Run $("#test").outerWidth(true)
- Also, not that $("#test").outerHeight(true) does NOT cause the page to jump.
comment:5 follow-up: 6 Changed 12 years ago by
Replying to timmywil:
That actually makes sense. Focusing on the element brings it into view. This is default browser behavior.
Here's an example of the bug on jQuery's own site.
- Navigate to http://api.jquery.com/
- Open Console
- Run $("#jq-primarySearch").attr("autofocus", true).parent().outerWidth(true);
comment:6 Changed 12 years ago by
Replying to Mike Hemesath <[email protected]…>:
Replying to timmywil:
That actually makes sense. Focusing on the element brings it into view. This is default browser behavior.
Here's an example of the bug on jQuery's own site.
- Navigate to http://api.jquery.com/
- Open Console
- Run $("#jq-primarySearch").attr("autofocus", true).parent().outerWidth(true);
Be sure to scroll to the bottom of the page before running the test case on api.jquery.com
comment:7 Changed 12 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Ah, you're right. I think this is related to #4872 then.
comment:8 follow-up: 9 Changed 12 years ago by
Blocked by: | 4872 added |
---|---|
Status: | reopened → open |
comment:9 Changed 12 years ago by
Replying to timmywil:
That bug was opened 22months ago? This issue can be resolved by downgrading jquery to 1.5.1 or 1.4.x. It appears it was broken in the last release.
comment:10 Changed 12 years ago by
I am also having a similar issue with I upgrade to a version greater than 1.5.1. Are you sure #4872 is blocking this issue?
comment:11 Changed 12 years ago by
Blocked by: | 4872 removed |
---|---|
Blocking: | 4872 added |
This has to do with the marginRight hook.
Thanks for taking the time to contribute to the jQuery project! I've created a test case based on your description and was unable to reproduce the issue experienced.
http://jsfiddle.net/timmywil/PedcV/show/
Please provide a test case on http://jsfiddle.net or update mine above. Additionally, test against the
jQuery (edge)
version to ensure the issue still exists.