HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2272WF2: Revamp of activation behavior definitions and related details.2008-10-03 01:08
@@ -929,26 +929,20 @@
 
   <!-- This section is currently here exclusively so that we crossref
   to textContent. XXX also add event-click, event-change,
   event-DOMActivate, etc, here, once DOM3 Events is ready for that,
   and just have the section be a general "defined in other
   specifications" section -->
 
   <p>The interface <dfn><code>DOMTimeStamp</code></dfn> is defined in
   DOM3 Core. <a href="#refsDOM3CORE">[DOM3CORE]</a></p>
 
-  <p>The term <dfn>activation behavior</dfn> is used as defined in the
-  DOM3 Events specification. <a
-  href="#refsDOM3EVENTS">[DOM3EVENTS]</a> <span class="XXX">At
-  the time of writing, DOM3 Events hadn't yet been updated to define
-  that phrase.</span></p>
-
   <p id="alternate-style-sheets">The rules for handling alternative
   style sheets are defined in the CSS object model specification. <a
   href="#refsCSSOM">[CSSOM]</a></p>
 
   <p class="XXX">See <a
   href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8">http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8</a></p>
   <!--XXX empty title attribute is equivalent to missing attribute for
   purposes of alternate style sheet processing -->
 
 
@@ -6613,75 +6607,129 @@ background: transparent">blue&lt;/span>.&lt;/p></pre>
   defined in this specification. (For example, MathML, or SVG.)</p>
 
   <p>Some embedded content elements can have <dfn>fallback
   content</dfn>: content that is to be used when the external resource
   cannot be used (e.g. because it is of an unsupported format). The
   element definitions state what the fallback is, if any.</p>
 
 
   <h5>Interactive content</h5>
 
-  <!-- Don't change the above <dfn> or the text below without checking
-  all cross-references. Some of them refer specifically to the
-  activation behavior stuff. -->
-
-  <p class="XXX">Parts of this section should eventually be
-  moved to DOM3 Events.</p> <!-- but see comment above -->
-
 <!--
 TESTS:
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cp%20tabindex%3D1%3Etest%20%3Ca%20href%3D%22%22%3E%20%3Cem%3Etest%3C/em%3E%20%3C/a%3E%0A%3Cscript%3E%0A%20function%20test%20%28e%29%20%7B%20w%28e.type%20+%20%27%20on%20%27%20+%20e.target.tagName%20+%20%27%20through%20%27%20+%20e.currentTarget.tagName%29%3B%20%7D%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27a%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27click%27%2C%20test%2C%20false%29%3B%0A%20document.getElementsByTagName%28%27p%27%29%5B0%5D.addEventListener%28%27DOMActivate%27%2C%20test%2C%20false%29%3B%0A%3C/script%3E%0A
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Ca%20href%3Dhttp%3A//google.com/%20target%3Da%3EA%3C/a%3E%3Ca%20href%3Dhttp%3A//yahoo.com/%20target%3Db%3EB%3C/a%3E%3Cbr%3E%0A%3Ciframe%20name%3Da%3E%3C/iframe%3E%3Ciframe%20name%3Db%3E%3C/iframe%3E%0A%3Cscript%3E%0A%20var%20a%20%3D%20document.getElementsByTagName%28%27a%27%29%5B0%5D%3B%0A%20var%20b%20%3D%20document.getElementsByTagName%28%27a%27%29%5B1%5D%3B%0A%20a.appendChild%28b%29%3B%0A%3C/script%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%20onsubmit%3D%22w%28%27onsubmit%27%29%22%3E%3Cem%3EA%3C/em%3E%3C/form%3E%0A%3Cscript%3E%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.attachEvent%28%27onsubmit%27%2C%20function%20%28%29%20%7B%20w%28%27submit%20fired%27%29%20%7D%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.fireEvent%28%27onsubmit%27%29%3B%0A%3C/script%3E
 http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0A%3Cform%20action%3D%22http%3A//google.com/%22%3EX%3C/form%3E%0A%3Cscript%3E%0Avar%20evt%20%3D%20document.createEvent%28%22Events%22%29%3B%0Aevt.initEvent%28%22submit%22%2C%20true%2C%20true%29%3B%0Adocument.getElementsByTagName%28%27form%27%29%5B0%5D.dispatchEvent%28evt%29%3B%0A%3C/script%3E
 -->
 
   <p><dfn>Interactive content</dfn> is content that is specifically
   intended for user interaction.</p>
 
-  <p>Certain elements in HTML can be activated, for instance
-  <code>a</code> elements, <code>button</code> elements, or
-  <code>input</code> elements when their <code
-  title="attr-input-type">type</code> attribute is in the <span
-  title="attr-input-type-radio">Radio Button</span> state. Activation
-  of those elements can happen in various (UA-defined) ways, for
-  instance via the mouse or keyboard.</p>
-
-  <p>When activation is performed via some method other than clicking
-  the pointing device, the default action of the event that triggers
-  the activation must, instead of being activating the element
-  directly, be to <span>fire a <code title="">click</code>
-  event</span> on the same element.</p>
-
-  <p>The default action of this <code title="event-click">click</code>
-  event, or of the real <code title="event-click">click</code> event
-  if the element was activated by clicking a pointing device, must be
-  to <span title="fire a DOMActivate event">fire a further <code
-  title="event-DOMActivate">DOMActivate</code> event</span> at the
-  same element, whose own default action is to go through all the
-  elements the <code title="event-DOMActivate">DOMActivate</code>
-  event bubbled through (starting at the target node and going towards
-  the <code>Document</code> node), looking for an element with an
-  <span>activation behavior</span>; the first element, in reverse tree
-  order, to have one, must have its activation behavior executed.</p>
+  <p>Certain elements in HTML have an <span>activation
+  behavior</span>, which means the user agent should allow the user to
+  manually trigger them in some way, for instance using keyboard or
+  voice input (though not mouse clicks, which are handled above). When
+  the user triggers an element with a defined <span>activation
+  behavior</span>, the default action of the interaction event<!-- XXX
+  --> must be to <span>run synthetic click activation steps</span> on
+  the element.</p>
+
+  <p>When a user agent is to <dfn>run synthetic click activation
+  steps</dfn> on an element, the user agent must <span>run pre-click
+  activation steps</span> on the element, then <span>fire a <code
+  title="event-click">click</code> event</span> at the element. The
+  default action of this <span title="event-click">click</span> event
+  must be to <span>run post-click activation steps</span> on the
+  element. If the event is canceled, the user agent must <span>run
+  canceled activation steps</span> on the element instead.</p>
+
+  <p>Given an element <var title="">target</var>, the <dfn>nearest
+  activatable element</dfn> is the element returned by the following
+  algorithm:</p>
+
+  <ol>
+
+   <li><p>If <var title="">target</var> has a defined <span>activation
+   behavior</span>, then return <var title="">target</var> and abort
+   these steps.</p></li>
+
+   <li><p>If <var title="">target</var> has a parent element, then set
+   <var title="">target</var> to that parent element and return to the
+   first step.</p></li>
+
+   <li><p>Otherwise, there is no <span>nearest activatable
+   element</span>.</p></li>
+
+  </ol>
+
+  <p>When a pointing device is clicked, the user agent must run these
+  steps:</p>
+
+  <ol>
+
+   <li><p>Let <var title="">e</var> be the <span title="">nearest
+   activatable element</span> of the element designated by the user,
+   if any.</p></li>
+
+   <li><p>If there is an element <var title="">e</var>, <span>run
+   pre-click activation steps</span> on it.</p></li>
+
+   <li>
+
+    <p>Dispatching the required <code title="event-click">click</code>
+    event.</p>
+
+    <p class="XXX">Another specification presumably requires the
+    firing of the <span title="event-click">click</span> event?</p>
+
+    <p>If there is an element <var title="">e</var>, then the default
+    action of the <span title="event-click">click</span> event must be
+    to <span>run post-click activation steps</span> on element <var
+    title="">e</var>.</p>
+
+    <p>If there is an element <var title="">e</var> but the event is
+    canceled, the user agent must <span>run canceled activation
+    steps</span> on element <var title="">e</var>.</p>
+
+   </li>
+
+  </ol>  
 
   <p class="note">The above doesn't happen for arbitrary synthetic
   events dispatched by author script. However, the <code
   title="dom-click">click()</code> method can be used to make it
   happen programmatically.</p>
 
-  <p>For certain form controls, this process is complicated further by
-  <a
-  href="http://www.whatwg.org/specs/web-forms/current-work/#the-click">changes
-  that must happen around the click event</a>. <a
-  href="#refsWF2">[WF2]</a></p> <!-- XXX WF2: when this is merged into
-  this spec, update xrefs -->
+  <p>When a user agent is to <dfn>run post-click activation
+  steps</dfn> on an element, the user agent must <span>fire a simple
+  event</span> called <code
+  title="event-DOMActivate">DOMActivate</code> at that element. The
+  default action of this event must be to <span>run final activation
+  steps</span> on that element. If the event is canceled, the user
+  agent must <span>run canceled activation steps</span> on the element
+  instead.</p>
+
+  <p>When a user agent is to <dfn>run pre-click activation steps</dfn>
+  on an element, it must run the <dfn>pre-click activation steps</dfn>
+  defined for that element, if any.</p>
+
+  <p>When a user agent is to <dfn>run canceled activation steps</dfn>
+  on an element, it must run the <dfn>canceled activation steps</dfn>
+  defined for that element, if any.</p>
+
+  <p>When a user agent is to <dfn>run final activation steps</dfn> on
+  an element, it must run the <dfn>activation behavior</dfn> defined
+  for that element. Activation behaviors can refer to the <code
+  title="event-click">click</code> and <code
+  title="event-DOMActivate">DOMActivate</code> events that were fired
+  by the steps above leading up to this point.</p>
 
 
 
   <h4>Transparent content models</h4>
 
   <p>Some elements are described as <dfn>transparent</dfn>; they have
   "transparent" as their content model. Some elements are described as
   <dfn>semi-transparent</dfn>; this means that part of their content
   model is "transparent" but that is not the only part of the content
   model that must be satisfied.</p>
@@ -11942,23 +11990,22 @@ first matching case):&lt;/p&gt;
    <li><p>If the <code title="event-DOMActivate">DOMActivate</code>
    event in question is not <span
    title="concept-events-trusted">trusted</span> (i.e. a <code
    title="dom-click">click()</code> method call was the reason for the
    event being dispatched), and the <code>a</code> element's <code
    title="attr-hyperlink-target">target</code> attribute is <span
    class="XXX">...</span> then raise an
    <code>INVALID_ACCESS_ERR</code> exception and abort these
    steps.</p></li>
 
-   <li><p>If the target of the <code
-   title="event-DOMActivate">DOMActivate</code> event is an
-   <code>img</code> element with an <code
+   <li><p>If the target of the <code title="event-click">click</code>
+   event is an <code>img</code> element with an <code
    title="attr-img-ismap">ismap</code> attribute specified, then
    server-side image map processing must be performed, as follows:</p>
 
     <ol>
 
      <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A...%3Ca%20href%3D%22%23%22%3E%3Cimg%20ismap%20usemap%3D%22%23a%22%20src%3D/resources/images/smallcats%3E%3C/a%3E%0A%3Cmap%20name%3Da%3E%3Carea%20shape%3Drect%20coords%3D0%2C0%2C50%2C50%20href%3Db%3E%3C/map%3E -->
 
      <li>If the <code title="event-DOMActivate">DOMActivate</code>
      event was dispatched as the result of a real
      pointing-device-triggered <code title="event-click">click</code>
@@ -11981,26 +12028,20 @@ first matching case):&lt;/p&gt;
    </li>
 
    <li><p>Finally, the user agent must <span title="following
    hyperlinks">follow the hyperlink</span> defined by the
    <code>a</code> element. If the steps above defined a <var>hyperlink
    suffix</var>, then take that into account when following the
    hyperlink.</p></li>
 
   </ol>
 
-  <p class="note">One way that a user agent can enable users to follow
-  hyperlinks is by allowing <code>a</code> elements to be clicked, or
-  focussed and activated by the keyboard. This <span
-  title="interactive content">will cause</span> the aforementioned
-  <span>activation behavior</span> to be invoked.</p>
-
   <p>The DOM attributes <dfn
   title="dom-a-href"><code>href</code></dfn>, <dfn
   title="dom-a-ping"><code>ping</code></dfn>, <dfn
   title="dom-a-target"><code>target</code></dfn>, <dfn
   title="dom-a-rel"><code>rel</code></dfn>, <dfn
   title="dom-a-media"><code>media</code></dfn>, <dfn
   title="dom-a-hreflang"><code>hreflang</code></dfn>, and <dfn
   title="dom-a-type"><code>type</code></dfn>, must each
   <span>reflect</span> the respective content attributes of the same
   name.</p>
@@ -22549,26 +22590,20 @@ function AddCloud(data, x, y) { ... }</pre>
    title="attr-area-target">target</code> attribute is <span
    class="XXX">...</span> then raise an
    <code>INVALID_ACCESS_ERR</code> exception.</li>
 
    <li>Otherwise, the user agent must <span title="following
    hyperlinks">follow the hyperlink</span> defined by the
    <code>area</code> element, if any.</li>
 
   </ol>
 
-  <p class="note">One way that a user agent can enable users to follow
-  hyperlinks is by allowing <code>area</code> elements to be clicked,
-  or focussed and activated by the keyboard. This <span
-  title="interactive content">will cause</span> the aforementioned
-  <span>activation behavior</span> to be invoked.</p>
-
   <p>The DOM attributes <dfn
   title="dom-area-alt"><code>alt</code></dfn>, <dfn
   title="dom-area-coords"><code>coords</code></dfn>, <dfn
   title="dom-area-href"><code>href</code></dfn>, <dfn
   title="dom-area-target"><code>target</code></dfn>, <dfn
   title="dom-area-ping"><code>ping</code></dfn>, <dfn
   title="dom-area-rel"><code>rel</code></dfn>, <dfn
   title="dom-area-media"><code>media</code></dfn>, <dfn
   title="dom-area-hreflang"><code>hreflang</code></dfn>, and <dfn
   title="dom-area-type"><code>type</code></dfn>, each must
@@ -25324,20 +25359,40 @@ function AddCloud(data, x, y) { ... }</pre>
   title="category-label">labelable form-associated element</span>,
   then that element is the <code>label</code> element's <span>labeled
   control</span>.</p>
 
   <p>If the <code title="attr-label-for">for</code> attribute is not
   specified, but the <code>label</code> element has a <span>labelable
   form-associated element</span> descendant, then the first such
   descendant in <span>tree order</span> is the <code>label</code>
   element's <span>labeled control</span>.</p>
 
+  <p>The <code>label</code> element's exact default presentation and
+  behavior, in particular what its <span>activation behavior</span>
+  might be, if anything, should match the platform's label
+  behavior.</p>
+
+  <div class="example">
+
+   <p>For example, on platforms where clicking a checkbox label checks
+   the checkbox, clicking the <code>label</code> in the following
+   snippet could trigger the user agent to <span>run synthetic click
+   activation steps</psna> on the <code>input</code> element, as if
+   the element itself had been triggered by the user:</p>
+
+   <pre>&lt;label>&lt;input type=checkbox name=lost> Lost&lt;/label></pre>
+
+   <p>On other platforms, the behavior might be just to focus the
+   control, or do nothing.</p>
+
+  </div>
+
   <p>The <code title="attr-fae-form">form</code> attribute is used to
   explicitly associate the <code>label</code> element with its
   <span>form owner</span>.</p>
 
   <p>The <dfn title="dom-label-htmlFor"><code>htmlFor</code></dfn> DOM
   attribute must <span>reflect</span> the <code
   title="attr-label-for">for</code> content attribute.</p>
 
   <p>The <dfn title="dom-label-control"><code>control</code></dfn> DOM
   attribute must return the <code>label</code> element's <span>labeled
@@ -25348,28 +25403,20 @@ function AddCloud(data, x, y) { ... }</pre>
   <p><span title="labelable form-associated element">Labelable
   form-associated elements</span> have a <code>NodeList</code> object
   associated with them that represents the list of <code>label</code>
   elements, in <span>tree order</span>, whose <span>labeled
   control</span> is the element in question. The <dfn
   title="dom-lfe-labels"><code>labels</code></dfn> DOM attribute of
   <span title="labelable form-associated element">labelable
   form-associated elements</span>, on getting, must return that
   <code>NodeList</code> object.</p>
 
-  <!-- The label element's exact default presentation and behaviour
-  should match the platform's label behaviour. For example, on
-  platforms where clicking a checkbox label checks the checkbox,
-  clicking a label element should cause a click event to be
-  synthesised and fired at the checkbox. XXX should define activation
-  behaviour here; clicking on nested link? nested label? label when it
-  has a checkbox? etc -->
-
 
   <h4>The <dfn><code>input</code></dfn> element</h4>
 
   <dl class="element">
    <dt>Categories</dt>
    <dd><span>Phrasing content</span>.</dd>
    <dd><span>Interactive content</span>.</dd>
    <dd><span title="category-listed">Listed</span>, <span title="category-label">labelable</span>, <span title="category-submit">submittable</span>, and <span title="category-reset">resettable</span> <span>form-associated element</span>.</dd>
    <dt>Contexts in which this element may be used:</dt>
    <dd>Where <span>phrasing content</span> is expected.</dd>
@@ -42939,30 +42986,25 @@ at the first element with the given ID must be treated as if it was cloned and r
   not respond to input? -->
 
   <p>The <dfn title="dom-hidden"><code>hidden</code></dfn> DOM
   attribute must <span>reflect</span> the content attribute of the
   same name.</p>
 
 
 
   <h3>Activation</h3>
 
-  <p>The <dfn title="dom-click">click()</dfn> method must <span>fire a
-  <code>click</code> event</span> at the element, whose default action
-  is the <span title="fire a DOMActivate event">firing of a further
-  <code title="event-DOMActivate">DOMActivate</code> event</span> at
-  the same element, whose own default action is to go through all the
-  elements the <code title="event-DOMActivate">DOMActivate</code>
-  event bubbled through (starting at the target node and going towards
-  the <code>Document</code> node), looking for an element with an
-  <span>activation behavior</span>; the first element, in reverse tree
-  order, to have one, must have its activation behavior executed.</p>
+  <p>The <dfn title="dom-click">click()</dfn> method must, if the
+  element has a defined <span>activation behavior</span>, <span>run
+  synthetic click activation steps</span> on the element. Otherwise,
+  the user agent must <span>fire a <code>click</code> event</span> at
+  the element.</p>
 
 
 
   <h3>Scrolling elements into view</h3>
 
   <p>The <dfn title="dom-scrollIntoView"><code>scrollIntoView([<var
   title="">top</var>])</code></dfn> method, when called, must cause
   the element on which the method was called to have the attention of
   the user called to it.</p>
 

|