HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/1122

SVNBugCommentTime (UTC)
1122[Gecko] [Internet Explorer] [Opera] [Webkit] Define fragment identifiers, id='', name='', etc.2007-11-05 16:37
Index: source
===================================================================
--- source	(revision 1121)
+++ source	(revision 1122)
@@ -25506,8 +25506,8 @@
    identifier, and the two share the same <code>Document</code>
    object, then <span>fire a simple event</span> with the name
    <code>hashchanged</code> at <span>the <code>body</code>
-   element</span>.</p> <p class="issue">I'm open to better event names
-   and targets here.</p></li>
+   element</span>, and, if the new URI has a fragment identifier,
+   <span>scroll to the fragment identifier</span>.</p></li>
 
    <li><p>User agents may also update other aspects of the document
    view when the location changes in this way, for instance the scroll
@@ -25847,7 +25847,7 @@
 
    <li><p>If the new resource is the same as the current resource, but
    a fragment identifier has been specified, then <span
-   title="navigate-fragid">scroll for that fragment identifier</span>
+   title="navigate-fragid">navigate to that fragment identifier</span>
    and abort these steps.</p></li>
 
    <li><p>If the new resource is to be handled by displaying some sort
@@ -26331,27 +26331,66 @@
 
 
 
-  <h4 id="scroll-to-fragid"><dfn title="navigate-fragid">Scrolling to a fragment identifier</dfn></h4>
+  <h4 id="scroll-to-fragid"><dfn title="navigate-fragid">Navigating to a fragment identifier</dfn></h4>
 
-  <p>When a user agent is supposed to scroll for a fragment
-  identifier, then the user agent must follow these steps:
+  <p>When a user agent is supposed to navigate to a fragment
+  identifier, then the user agent must <span>update the session
+  history with the new page</span>, where "the new page" has the same
+  <code>Document</code> as before but with the URI having the newly
+  specified fragment identifier.</p>
 
+  <p>Part of that algorithm involves the user agent having to
+  <span>scroll to the fragment identifier</span>, which is the
+  important part for this step.</p>
+
+  <p>When the user agent is required to <dfn>scroll to the fragment
+  identifier</dfn>, it must change the scrolling position of the
+  document, or perform some other action, such that <span>the
+  indicated part of the document</span> is brought to the user's
+  attention. If there is no indicated part, then the user agent must
+  not scroll anywhere.</p>
+
+  <p>The <dfn>the indicated part of the document</dfn> is the one that
+  the fragment identifier identifies. The semantics of the fragment
+  identifier in terms of mapping it to a specific DOM Node is defined
+  by the MIME type specification of the document's MIME Type (for
+  example, the processing of fragment identifiers for XML MIME types
+  is the responsibility of RFC3023).</p>
+
+  <p>For HTML documents (and the <code>text/html</code> MIME type),
+  the following processing model must be followed to determine what
+  <span>the indicated part of the document</span> is.</p>
+
   <ol>
 
-   <li><p>First, <span>update the session history with the new
-   page</span>, where "the new page" has the same
-   <code>Document</code> as before but with the URI having the newly
-   specified fragment identifier.</p></li>
+   <li><p>Let <i>fragid</i> be the &lt;fragment&gt; part of the
+   URI. <a href="#refsRFC3987">[RFC3987]</a></p></li> <!-- IRI,
+   ifragment? XXX -->
 
-   <li><p>Then, change the scrolling position of the document, or
-   perform some other action, such that <span>the indicated part of
-   the document</span> is brought to the user's attention.</p></li>
+   <li><p>If <i>fragid</i> is the empty string, then the the indicated
+   part of the document is the top of the document.</p></li>
 
+   <li><p>If there is an element in the DOM that has an ID exactly
+   equal to <i>fragid</i>, then the first such element in tree order
+   is <span>the indicated part of the document</span>; stop the
+   algorithm here.</p></li>
+
+   <li><p>If there is an <code>a</code> element in the DOM that has a
+   <code title="attr-a-name">name</code> attribute whose value is
+   exactly equal to <i>fragid</i>, then the first such element in tree
+   order is <span>the indicated part of the document</span>; stop the
+   algorithm here.</p></li>
+
+   <li><p>Otherwise, there is no indicated part of the
+   document.</p></li>
+
   </ol>
 
-  <p class="big-issue">how to get "<dfn>the indicated part of the
-  document</dfn>" from a frag id -- id="", name="", XPointer, etc;
-  missing IDs (e.g. the infamous "#top")</p>
+  <p>For the purposes of the interaction of HTML with Selectors' <code
+  title"">:target</code> pseudo-class, the <i>target element</i> is
+  <span>the indicated part of the document</span>, if that is an
+  element; otherwise there is no <i>target element</i>. <a
+  href="#refsSELECTORS">[SELECTORS]</a></p>
 
 
 
@@ -41186,8 +41225,8 @@
   Darin Fisher, Dave Singer, Dave Townsend<!-- Mossop on moz irc -->,
   David Baron, David Flanagan, David H&aring;s&auml;ther, David Hyatt,
   Derek Featherstone, Dimitri Glazkov, dolphinling, Doron Rosenberg,
-  Eira Monstad, Elliotte Harold, Erik Arvidsson, Evan Martin,
-  fantasai, Franck 'Shift' Qu&eacute;lain, Geoffrey Sneddon,
+  Doug Kramer, Eira Monstad, Elliotte Harold, Erik Arvidsson, Evan
+  Martin, fantasai, Franck 'Shift' Qu&eacute;lain, Geoffrey Sneddon,
   H&aring;kon Wium Lie, Henri Sivonen, Henrik Lied, Ignacio Javier,
   Ivo Emanuel Gon&ccedil;alves, J. King, James Graham, James M Snell,
   James Perrett, Jan-Klaas Kollhof, Jasper Bryant-Greene, Jeff

|