Unlike in Netscape 4 or Internet Explorer, href="#top" does not jump to the top of the page by default (without defining the <a>). It's a simple and much used function.
First of all, <a href="#top"> without a <a name="top"> or <sometag id="top"> brings you to the top of the page in IE and NS4 because it is an undefined name/id. You could try even using <a href="#"> or <a href="#someundefinedname"> it would work as long as the name is not defined. So why doesn't this work in Mozilla? Well I think the question should be why did it work in IE and NS4 in the first place? It worked in those browsers just because they reload the pages whenever a link it click (regardless of whether the link is within the same page or not), so the page jumps to the top when an undefined name/id is used. Mozilla doesn't reload the page, instead when such a link is clicked it scrolls to name/id position. As a result you get the different behaviors. There are 2 ways to go to the top of the page without adding <a name="top"> at the top of every page: 1. <body id="top"> or any other id you like to use on the <body> 2. change <a href="#top"> to <a href="#">. This will force mozilla to reload the page.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → INVALID
SPAM. HTML Element component deprecated, changing component to Layout. See bug 88132 for details.
Component: HTML Element → Layout
Status: RESOLVED → VERIFIED
I guess this is part of: http://dev.w3.org/html5/spec/Overview.html#scroll-to-fragid " When the user agent is required to scroll to the fragment identifier, it must change the scrolling position of the document using the scroll an element into view algorithm defined in the CSSOM View specification, or perform some other action, such that the indicated part of the document is brought to the user's attention. If there is no indicated part, then the user agent must not scroll anywhere. [CSSOMVIEW] " Except, all other major browser (apart from Firefox) seem to be scrolling to the top in this case.
This bug is about making #top magical, even if there's no element with id="top" or name="top". I don't see how your comment is related.
Oh, I suppose you were emphasizing the "If there is no indicated part, then the user agent must not scroll anywhere."
Martijn, you presumably want to bring this up as a spec issue, right? If the other browsers aren't willing to change this special-casing of #top, then we may need to spec it (e.g. what about "#TOP" or "#ToP") and then implement the spec....
Actually, the spec says this already. See http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document step 6. Ms2ger, want to do this?
Status: VERIFIED → REOPENED
Ever confirmed: true
Resolution: INVALID → ---
Assignee: clayton → Ms2ger
OS: Windows 2000 → All
QA Contact: moied → layout
Hardware: x86 → All
Created attachment 561760 [details] [diff] [review] Patch v1
Attachment #561760 - Flags: review?(bzbarsky)
Comment on attachment 561760 [details] [diff] [review] Patch v1 Nix the doctypes on tests 4 and 6, and add a comment to the top of the even-numbered tests saying they're purposefully in quirks mode. r=me with that.
Attachment #561760 - Flags: review?(bzbarsky) → review+
Thanks, will do.
Status: REOPENED → ASSIGNED
Keywords: dev-doc-needed, html5
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago → 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Should this be documented as an expected behavior or just as a compatibility tweak for older sites?
I'm not sure there's a distinction, since the spec will require this.
<https://developer.mozilla.org/en/Mozilla_Quirks_Mode_Behavior> also needs a fix.
Documentation updated: https://developer.mozilla.org/en/Mozilla_Quirks_Mode_Behavior https://developer.mozilla.org/en/HTML/Element/a And mentioned on Firefox 10 for developers.
Keywords: dev-doc-needed → dev-doc-complete
I updated the quirks list a little more. (I also removed the sentence you added saying that this quirk broke in Gecko 2.0 -- I didn't see any evidence for that, though maybe I'm missing something.) (And, boy, it's really annoying that the devmo wiki won't let you look at the page history while you're editing a page -- you get popped back into an editor saying that you have an unsaved draft.)
You need to log in before you can comment on or make changes to this bug.