[Webkit-unassigned] [Bug 14867] Fails to scroll to top of page when loading URL w/ empty reference fragment
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 10 22:05:49 PDT 2008
http://bugs.webkit.org/show_bug.cgi?id=14867
yuzhu.shen at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yuzhu.shen at gmail.com
------- Comment #3 from yuzhu.shen at gmail.com 2008-03-10 22:05 PDT -------
With <a href="#">, WebKit interprets the fragment identifier as a null string.
And then WebKit searches the anchor node in two steps: (in bool
FrameLoader::gotoAnchor(const String& name))
1) searches any node whose id attribute is the same as the fragment identifier.
If the fragment identifier is a null string, it returns directly.
2) searches in a set of <a> elements that have name attributes, using
HTMLCollection::namedItem().
It should be noted that namedItem() first searches for an object with a
matching id attribute. If a match is not
found, the method then searches for an object with a matching name attribute.
Consider the following node:
<a name="anyname">...</a>
Its id attribute is not specified (returned as a null string when querying
it). If we are searching with a null
fragment identifier, it will match this node, no matter what its name attribute
is.
As a result, clicking the "Goto Top" link in the page below will bring you to
the "youwillgethere" anchor but not the
top of the page.
=======================================
...
<a href="#">Goto Top</a>
...
...
<a name="youwillgethere">Oops!</a>
...
=======================================
I will upload a patch soon.
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list