[Webkit-unassigned] [Bug 17714] anchor elements href="#" and "name" attribute cause the page to jump to the end
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Mar 11 05:55:55 PDT 2008
http://bugs.webkit.org/show_bug.cgi?id=17714
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-11 05:55 PDT -------
This issue is similar with bug 14867. Because of revision 30243, however, bug
14867 is ok now.
In revision 30243, FrameLoader::gotoAnchor() is modified:
DeprecatedString ref = m_URL.encodedHtmlRef(); --> String ref = m_URL.ref();
With this change, WebKit now interprets the fragment identifier of <a href="#">
as an empty string (length = 0) instead of a null string.
As I commented in bug 14867, 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 an empty 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="">...</a>
Its id attribute is not specified (returned as a null string when querying
it), so it won't match. However, if we are searching with a empty string, it
will match the name attribute.
As a result, clicking the "Goto Top" link in the page below will bring you to
the anchor "Oops!" but not the top of the page.
=======================================
...
<a href="#">Goto Top</a>
...
...
<a name="">Oops!</a>
...
=======================================
--
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