Closed
Bug 93539
Opened 23 years ago
Closed 23 years ago
location.href="#ANCHOR_NAME" should scroll page to specified anchor
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: reliqnet, Assigned: jst)
References
()
Details
From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) BuildID: 2001080303 I have an HTML page, and on the page, I have defined the following JavaScript: <script language="javascript"> location.href = "#bottom"; </script> On page load, this bit of JavaScript SHOULD take me to the place on the page anchored by the "bottom" tag (i.e., <a name="bottom">bottom of the page</a>), but it does not. I have to hit the REFRESH button for this to happen. Reproducible: Always Steps to Reproduce: 1. Go to page. 2. Witness nothing happen. 3. Hit REFRESH, and page does as it should (reflows). Actual Results: Nothing happens. Expected Results: Page should reflow to place on page with anchor tag. IE, Opera, and Netscape 4.x all do the right thing and reflow the page. Mozilla does not.
Comment 1•23 years ago
|
||
-> DOM Level 0 Changing "reflow" to "scroll" in the summary.
Assignee: rogerl → jst
Component: Javascript Engine → DOM Level 0
QA Contact: pschwartau → desale
Summary: location.href="#ANCHOR_NAME" should reflow page to specified anchor → location.href="#ANCHOR_NAME" should scroll page to specified anchor
Comment 2•23 years ago
|
||
Confirming, Win NT build 2001080603.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•23 years ago
|
||
Does this break existing web-pages? I would argue that mozilla does the right thing here, you're asking it in the head of the document to scroll to something that hasn't been seen by the parser yet, mozilla looks for the thing to scroll to, but doesn't find it and doesn't scroll anywhere. The "right" way to do what the testcase does is to do the scrolling from the onload handler on the page, i.e.: <body onload="location.href='#bottom';"> Re-open and show us a real page that breaks because of this and we'll reconsider.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Reporter | ||
Updated•23 years ago
|
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Reporter | ||
Comment 4•23 years ago
|
||
>>> you're asking it in the head of the document to scroll to something
that hasn't been seen by the parser yet <<<
Well, I could have just as simply placed the JavaScript at the very bottom of
the HTML code, after the ending </html> tag. Would that warrant fixing the bug?
Mozilla still doesn't do the right thing if the script is located at the very
bottom, and is read after the parser's gone through everything. I've already
tested this, but so that you can see it, I'll update my sample page tomorrow
morning when I get to the office.
Reporter | ||
Comment 5•23 years ago
|
||
Updated so that JavaScript occurs at the end of the page (after the parser has read everything): http://www.cinteractive.com/users/trieu/mozilla/mozilla-javascript-anchor-bug.html
Assignee | ||
Comment 6•23 years ago
|
||
I'm still not convinced that I wanto fix this (now the testcase has the script tag *after* the end </html> tag, this is invalid HTML, btw). Why don't you just set the lo cation from the onload handler in the document? Again, show me existing pages that break due to this and I'll re-think...
Reporter | ||
Comment 7•23 years ago
|
||
I did use the onLoad, eventually, but I figured I'd report the odd behavior anyway. It's just strange because the browser goes to the right location (page.html?#place), but the browswer window just doesn't scroll to it, which I found a bit odd.
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•