html5/spec Overview.html,1.902,1.903

Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv25839

Modified Files:
	Overview.html 
Log Message:
Define .focus(), .blur(), onfocus, and onblur in a way that doesn't require an infinite loop in the face of a hostile author, and that is better defined in terms of multiple iframes, windows, and orphaned elements. Allow UAs to ignore .blur(). Fix up the mess around the body element having focus. (whatwg r1716)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.902
retrieving revision 1.903
diff -u -d -r1.902 -r1.903
--- Overview.html	29 May 2008 12:12:14 -0000	1.902
+++ Overview.html	1 Jun 2008 10:48:31 -0000	1.903
@@ -58,11 +58,11 @@
    <h2 class="no-num no-toc" id=a-vocabulary>A vocabulary and associated APIs
     for HTML and XHTML</h2>
 
-   <h2 class="no-num no-toc" id=w3c-working>W3C Working Draft 29 May 2008</h2>
+   <h2 class="no-num no-toc" id=w3c-working>W3C Working Draft 1 June 2008</h2>
 
    <dl><!-- ZZZ
     <dt>This Version:</dt>
-    <dd><a href="http://www.w3.org/TR/2008/WD-html5-20080529/">http://www.w3.org/TR/2008/WD-html5-20080529/</a></dd>
+    <dd><a href="http://www.w3.org/TR/2008/WD-html5-20080601/">http://www.w3.org/TR/2008/WD-html5-20080601/</a></dd>
 -->
 
     <dt>Latest Published Version:
@@ -192,7 +192,7 @@
   <p>The W3C <a href="http://www.w3.org/html/wg/">HTML Working Group</a> is
    the W3C working group responsible for this specification's progress along
    the W3C Recommendation track.<!--ZZZ This
-  specification is the 29 May 2008 First Public Working Draft.--></p>
+  specification is the  1 June 2008 First Public Working Draft.--></p>
   <!-- relationship to other work (required) -->
 
   <p>This specification is also being produced by the <a
@@ -7276,19 +7276,6 @@
 
   <h3 id=interaction><span class=secno>3.5 </span><dfn
    id=interaction0>Interaction</dfn></h3>
-  <!--
-ELEMENT
-           attribute long <span title="dom-tabindex">tabIndex</span>;
-  void <span title="dom-click">click</span>();
-  void <span title="dom-focus">focus</span>();
-  void <span title="dom-blur">blur</span>();
-  void <span title="dom-scrollIntoView">scrollIntoView</span>();
-  void <span title="dom-scrollIntoView">scrollIntoView</span>(in boolean top);
-
-DOCUMENT
-  readonly attribute <span>Element</span> <span title="dom-document-activeElement">activeElement</span>;
-  readonly attribute boolean <span title="dom-document-hasFocus">hasFocus</span>;
--->
 
   <h4 id=activation><span class=secno>3.5.1 </span>Activation</h4>
 
@@ -7304,38 +7291,110 @@
    tree order, to have one, must have its activation behavior executed.
 
   <h4 id=focus><span class=secno>3.5.2 </span>Focus</h4>
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%20%0A...%3Cform%3E%3Cinput%20name%3Da%20onfocus%3D%22value%2B%3D1%3Bd.name%3D%27a%27%3Bname%3D%27d%27%3Bb.focus()%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22value%2B%3D1%3Bc.focus()%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22value%2B%3D1%3Bd.focus()%22%3E%0A%3Cinput%20name%3Dd%20onfocus%3D%22value%2B%3D1%3Ba.focus()%22%3E -->
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af1%20%27%3Bb.focus()%3Balert(document.activeElement.name)%3Bt.value%2B%3D%27af2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22t.value%2B%3D%27cf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27cf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27cb%20%27%3B%22%3E%0A -->
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%20onload%3D%22document.forms%5B0%5D.a.focus()%22%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onblur%3D%22t.value%2B%3D'ab%20'%3B%20b.focus()%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D'bf1%20'%3Ba.focus()%3Bt.value%2B%3D'bf2%20'%3B%22%20onblur%3D%22t.value%2B%3D'bb%20'%3B%22%3E -->
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab1%20%27%3Bb.focus()%3Bt.value%2B%3D%27ab2%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Ba.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E -->
 
   <p>When an element is <em>focused</em>, key events received by the document
-   must be targeted at that element. There is always an element focused; in
-   the absence of other elements being focused, the document's root element
-   is it.
+   must be targeted at that element. There may be no element focused; when no
+   element is focused, key events received by the document must be targetted
+   at <a href="#the-body1">the <code>body</code> element</a>.
 
-  <p>Which element within a document currently has focus is independent of
-   whether or not the document itself has the <em>system focus</em>.
+  <p>User agents may track focus for each <a href="#browsing1">browsing
+   context</a> or <code>Document</code> individually, or may support only one
+   focused elment per <a href="#top-level">top-level browsing context</a>
+   &mdash; user agents should follow platform conventions in this regard.
 
-  <p>Some focusable elements might take part in <em>sequential focus
-   navigation</em>.
+  <p>Which element(s) within a <a href="#top-level">top-level browsing
+   context</a> currently has focus must be independent of whether or not the
+   <a href="#top-level">top-level browsing context</a> itself has the
+   <em>system focus</em>.
 
   <h5 id=focus-management><span class=secno>3.5.2.1. </span>Focus management</h5>
 
-  <p>The <dfn id=focus0 title=dom-focus><code>focus()</code></dfn> and <dfn
-   id=blur title=dom-blur><code>blur()</code></dfn> methods must focus and
-   unfocus the element respectively, if the element is focusable.
+  <p>The <dfn id=focusing>focusing steps</dfn> are as follows:
 
-  <p>Some elements, most notably <code><a href="#area">area</a></code>, can
-   correspond to more than one distinct focusable area. When such an element
-   is focused using the <code title=dom-focus><a
-   href="#focus0">focus()</a></code> method, the first such region in tree
-   order is the one that must be focused.
+  <ol>
+   <li>
+    <p>If focusing the element will remove the focus from another element,
+     then run the <a href="#unfocusing">unfocusing steps</a> for that
+     element.
 
-  <p class=big-issue>Well that clearly needs more.</p>
-  <!-- XXX e.g. should the click, focus, blur methods be recursible? -->
+   <li>
+    <p>Make the element the currently focused element in its <a
+     href="#top-level">top-level browsing context</a>.</p>
+
+    <p>Some elements, most notably <code><a href="#area">area</a></code>, can
+     correspond to more than one distinct focusable area. If a particular
+     area was indicated when the element was focused, then that is the area
+     that must get focus; otherwise, e.g. when using the <code
+     title=dom-focus><a href="#focus0">focus()</a></code> method, the first
+     such region in tree order is the one that must be focused.</p>
+
+   <li>
+    <p><a href="#firing2">Fire a simple event</a> that doesn't bubble called
+     <code title=event-focus>focus</code> at the element.
+  </ol>
+
+  <p>User agents must run the <a href="#focusing">focusing steps</a> for an
+   element whenever the user moves the focus to a <a
+   href="#focusable">focusable</a> element.
+
+  <p>The <dfn id=unfocusing>unfocusing steps</dfn> are as follows:
+
+  <ol><!-- XXX onchange event for input controls -->
+
+   <li>
+    <p>Unfocus the element.
+
+   <li>
+    <p><a href="#firing2">Fire a simple event</a> that doesn't bubble called
+     <code title=event-blur>blur</code> at the element.
+  </ol>
+
+  <p>User agents should run the <a href="#unfocusing">unfocusing steps</a>
+   for an element whenever the user moves the focus away from any <a
+   href="#focusable">focusable</a> element.
+
+  <hr>
+
+  <p>The <dfn id=focus0 title=dom-focus><code>focus()</code></dfn> method,
+   when invoked, must run the following algorithm:
+
+  <ol>
+   <li>
+    <p>If the element is marked as <i><a href="#locked">locked for
+     focus</a></i>, then abort these steps.
+
+   <li>
+    <p>If the element is not <a href="#focusable">focusable</a>, then abort
+     these steps.
+
+   <li>
+    <p>Mark the element as <dfn id=locked>locked for focus</dfn>.
+
+   <li>
+    <p>If the element is not already focused, run the <a
+     href="#focusing">focusing steps</a> for the element.
+
+   <li>
+    <p>Unmark the element as <i><a href="#locked">locked for focus</a></i>.
+  </ol>
+
+  <p>The <dfn id=blur title=dom-blur><code>blur()</code></dfn> method, when
+   invoked, should run the <a href="#unfocusing">unfocusing steps</a> for the
+   element. User agents may selectively or uniformly ignore calls to this
+   method for usability reasons.</p>
+  <!-- XXX define onfocus/onblur behaviour for Window -->
+
+  <hr>
 
   <p>The <dfn id=activeelement
    title=dom-document-activeElement><code>activeElement</code></dfn>
-   attribute must return the element in the document that has focus. If no
-   element specifically has focus, this must return <a href="#the-body1">the
-   <code>body</code> element</a>.
+   attribute must return the element in the document that is focused. If no
+   element in the <code>Document</code> is focused, this must return <a
+   href="#the-body1">the <code>body</code> element</a>.
 
   <p>The <dfn id=hasfocus
    title=dom-document-hasFocus><code>hasFocus</code></dfn> attribute must
@@ -7428,6 +7487,13 @@
     </ul>
   </dl>
 
+  <p>An element is <dfn id=focusable>focusable</dfn> if the <code
+   title=attr-tabindex><a href="#tabindex">tabindex</a></code> attribute's
+   definition above defines the element to be focusable <em>and</em> the
+   element is <span>being
+   rendered</span><!-- XXX xref, define display:none as not
+  being rendered, off-screen as being rendered? -->.
+
   <p>When an element is focused, the element matches the CSS
    <code>:focus</code> pseudo-class and key events are dispatched on that
    element in response to keyboard input.
@@ -30001,8 +30067,8 @@
   <p><dfn id=firing2 title="fire a simple event">Firing a simple event called
    <var title="">e</var></dfn> means that an event with the name <var
    title="">e</var>, with no namespace, which does not bubble but is
-   cancelable, and which uses the <code>Event</code> interface, must be
-   dispatched at the given element.
+   cancelable (unless otherwise stated), and which uses the
+   <code>Event</code> interface, must be dispatched at the given element.
 
   <p><dfn id=firing3 title="fire a show event">Firing a <code
    title=event-show>show</code> event</dfn> means <a href="#firing2"

Received on Sunday, 1 June 2008 10:49:09 UTC