Beginning on October 25th, 2016, Persona will no longer be an option for authentication on BMO. For more details see Persona Deprecated.
Last Comment Bug 93077 - href="#top" does not work like in IE/NS4
: href="#top" does not work like in IE/NS4
: dev-doc-complete, html5
Product: Core
Classification: Components
Component: Layout (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla10
Assigned To: :Ms2ger (⌚ UTC+1/+2)
: Jet Villegas (:jet)
: 678915 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2001-08-01 06:20 PDT by Paul van Dam
Modified: 2011-12-28 11:30 PST (History)
7 users (show)
Ms2ger: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch v1 (9.12 KB, patch)
2011-09-22 08:45 PDT, :Ms2ger (⌚ UTC+1/+2)
bzbarsky: review+
Details | Diff | Splinter Review

Description Paul van Dam 2001-08-01 06:20:04 PDT
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 
Comment 1 basic 2001-08-01 09:11:57 PDT
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
Comment 2 Heikki Toivonen (remove -bugzilla when emailing directly) 2001-09-05 10:43:48 PDT
SPAM. HTML Element component deprecated, changing component to Layout. See bug
88132 for details.
Comment 3 Moied 2002-02-10 23:49:21 PST
Verified invalid
Comment 4 Aaron Train [:aaronmt] 2011-08-15 10:00:33 PDT
*** Bug 678915 has been marked as a duplicate of this bug. ***
Comment 5 Martijn Wargers [:mwargers] (not working for Mozilla) 2011-08-15 10:18:14 PDT
I guess this is part of:
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.
Comment 6 David Baron :dbaron: ⌚️UTC-7 2011-08-15 20:28:53 PDT
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.
Comment 7 David Baron :dbaron: ⌚️UTC-7 2011-08-15 20:29:49 PDT
Oh, I suppose you were emphasizing the "If there is no indicated part, then the user agent must not scroll anywhere."
Comment 8 Boris Zbarsky [:bz] (still a bit busy) 2011-08-23 01:10:25 PDT
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....
Comment 9 Boris Zbarsky [:bz] (still a bit busy) 2011-08-23 01:12:05 PDT
Actually, the spec says this already.  See step 6.

Ms2ger, want to do this?
Comment 10 :Ms2ger (⌚ UTC+1/+2) 2011-09-22 08:45:08 PDT
Created attachment 561760 [details] [diff] [review]
Patch v1
Comment 11 Boris Zbarsky [:bz] (still a bit busy) 2011-09-22 09:02:29 PDT
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.
Comment 12 :Ms2ger (⌚ UTC+1/+2) 2011-10-01 08:39:24 PDT
Thanks, will do.
Comment 13 :Ms2ger (⌚ UTC+1/+2) 2011-10-02 07:18:55 PDT
Comment 14 Eric Shepherd [:sheppy] 2011-12-12 09:03:27 PST
Should this be documented as an expected behavior or just as a compatibility tweak for older sites?
Comment 15 Boris Zbarsky [:bz] (still a bit busy) 2011-12-12 09:50:22 PST
I'm not sure there's a distinction, since the spec will require this.
Comment 16 :Ms2ger (⌚ UTC+1/+2) 2011-12-12 11:18:56 PST
<> also needs a fix.
Comment 17 Eric Shepherd [:sheppy] 2011-12-14 06:30:31 PST
Documentation updated:

And mentioned on Firefox 10 for developers.
Comment 18 David Baron :dbaron: ⌚️UTC-7 2011-12-28 11:30:06 PST
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.)

Note You need to log in before you can comment on or make changes to this bug.