Skip to content

Commit

Permalink
[e] (0) Move activation stuff from the part of the spec that talks ab…
Browse files Browse the repository at this point in the history
…out elements to the part of the spec that talks about user interaction

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24480
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@8453 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Feb 3, 2014
1 parent abe9b4a commit 65f0070
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 322 deletions.
206 changes: 103 additions & 103 deletions complete.html
Expand Up @@ -9956,108 +9956,7 @@ <h6 id=interactive-content-0><span class=secno>3.2.4.1.7 </span>Interactive cont
<li><code><a href=#the-select-element>select</a></code></li>
<li><code><a href=#the-textarea-element>textarea</a></code></li>
<li><code><a href=#the-video-element>video</a></code> (if the <code title=attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)</li>
</ul><p>Certain elements in HTML have an <a href=#activation-behavior>activation behavior</a>, which means that the user
can activate them. This triggers a sequence of events dependent on the activation mechanism, and
normally culminating in a <code title=event-click><a href=#event-click>click</a></code> event<span class=impl>, as
described below</span>.</p>

<div class=impl>

<p>The user agent should allow the user to manually trigger elements that have an <a href=#activation-behavior>activation
behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
user triggers an element with a defined <a href=#activation-behavior>activation behavior</a> in a manner other than
clicking it, the default action of the interaction event must be to <a href=#run-synthetic-click-activation-steps>run synthetic click
activation steps</a> on the element.</p> <!-- interaction event spec point -->

<p>Each element has a <var title="">click in progress</var> flag, initially set to false.</p>

<p>When a user agent is to <dfn id=run-synthetic-click-activation-steps>run synthetic click activation steps</dfn> on an element, the user
agent must run the following steps:</p>

<ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
these steps.</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

<li><p><a href=#run-pre-click-activation-steps>Run pre-click activation steps</a> on the element.</li>

<li><p><a href=#fire-a-click-event>Fire a <code title=event-click>click</code> event</a> at the element. If the
<a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> algorithm was invoked because the <code title=dom-click><a href=#dom-click>click()</a></code> method was invoked, then the <code title=dom-event-isTrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute must be initialized to false.</li>

<li>

<p>If this <code title=event-click><a href=#event-click>click</a></code> event is not canceled, <a href=#run-post-click-activation-steps>run post-click
activation steps</a> on the element.</p>

<p>If the event <em>is</em> canceled, the user agent must <a href=#run-canceled-activation-steps>run canceled activation
steps</a> on the element instead.</p>

</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

</ol><p>When a pointing device is clicked, the user agent must run these steps:</p>

<ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
these steps.</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

<li><p>Let <var title="">e</var> be the <a href=#nearest-activatable-element>nearest activatable element</a> of the element
designated by the user (defined below), if any.</li>

<li><p>If there is an element <var title="">e</var>, <a href=#run-pre-click-activation-steps>run pre-click activation steps</a>
on it.</li>

<li>

<p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> the required <code title=event-click><a href=#event-click>click</a></code> event.</p> <!-- interaction event spec point -->

<p>If there is an element <var title="">e</var> and the <code title=event-click><a href=#event-click>click</a></code>
event is not canceled, <a href=#run-post-click-activation-steps>run post-click activation steps</a> on element <var title="">e</var>.</p>

<p>If there is an element <var title="">e</var> and the event <em>is</em> canceled, <a href=#run-canceled-activation-steps>run
canceled activation steps</a> on element <var title="">e</var>.</p>

</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

</ol><p class=note>The algorithms above don't run for arbitrary synthetic events dispatched by author
script. The <code title=dom-click><a href=#dom-click>click()</a></code> method can be used to make the <a href=#run-synthetic-click-activation-steps>run
synthetic click activation steps</a> algorithm happen programmatically.</p>

<p class=note>Click-focusing behavior (e.g. the focusing of a text field when user clicks in
one) typically happens before the click, when the mouse button is first depressed, and is
therefore not discussed here.</p> <!-- interaction event spec point -->

<p>Given an element <var title="">target</var>, the <dfn id=nearest-activatable-element>nearest activatable element</dfn> is the
element returned by the following algorithm:</p>

<ol><li><p>If <var title="">target</var> has a defined <a href=#activation-behavior>activation behavior</a>, then return
<var title="">target</var> and abort these steps.</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.</li>

<li><p>Otherwise, there is no <a href=#nearest-activatable-element>nearest activatable element</a>.</li>

</ol><p>When a user agent is to <dfn id=run-pre-click-activation-steps>run pre-click activation steps</dfn> on an element, it must run
the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn> defined for that element, if any.</p>

<p>When a user agent is to <dfn id=run-canceled-activation-steps>run canceled activation steps</dfn> on an element, it must run the
<dfn id=canceled-activation-steps>canceled activation steps</dfn> defined for that element, if any.</p>

<p>When a user agent is to <dfn id=run-post-click-activation-steps>run post-click activation steps</dfn> on an element, it must run
the <dfn id=activation-behavior>activation behavior</dfn> defined for that element, if any. Activation behaviors can
refer to the <code title=event-click><a href=#event-click>click</a></code> event that was fired by the steps above
leading up to this point.</p>

</div>



<h6 id=palpable-content-0><span class=secno>3.2.4.1.8 </span>Palpable content</h6>
</ul><h6 id=palpable-content-0><span class=secno>3.2.4.1.8 </span>Palpable content</h6>

<p>As a general rule, elements whose content model allows any <a href=#flow-content>flow content</a> or
<a href=#phrasing-content>phrasing content</a> should have at least one node in its <a href=#concept-html-contents title=concept-html-contents>contents</a> that is <dfn id=palpable-content>palpable
Expand Down Expand Up @@ -76029,9 +75928,110 @@ <h4 id=the-inert-attribute><span class=secno>8.2.1 </span>The <dfn title=attr-in
content attribute of the same name.</p>


<!--TOPIC:DOM APIs-->

<h3 id=activation><span class=secno>8.3 </span>Activation</h3>

<p>Certain elements in HTML have an <a href=#activation-behavior>activation behavior</a>, which means that the user
can activate them. This triggers a sequence of events dependent on the activation mechanism, and
normally culminating in a <code title=event-click><a href=#event-click>click</a></code> event<span class=impl>, as
described below</span>.</p>

<div class=impl>

<p>The user agent should allow the user to manually trigger elements that have an <a href=#activation-behavior>activation
behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
user triggers an element with a defined <a href=#activation-behavior>activation behavior</a> in a manner other than
clicking it, the default action of the interaction event must be to <a href=#run-synthetic-click-activation-steps>run synthetic click
activation steps</a> on the element.</p> <!-- interaction event spec point -->

<p>Each element has a <var title="">click in progress</var> flag, initially set to false.</p>

<p>When a user agent is to <dfn id=run-synthetic-click-activation-steps>run synthetic click activation steps</dfn> on an element, the user
agent must run the following steps:</p>

<ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
these steps.</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

<li><p><a href=#run-pre-click-activation-steps>Run pre-click activation steps</a> on the element.</li>

<li><p><a href=#fire-a-click-event>Fire a <code title=event-click>click</code> event</a> at the element. If the
<a href=#run-synthetic-click-activation-steps>run synthetic click activation steps</a> algorithm was invoked because the <code title=dom-click><a href=#dom-click>click()</a></code> method was invoked, then the <code title=dom-event-isTrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute must be initialized to false.</li>

<li>

<p>If this <code title=event-click><a href=#event-click>click</a></code> event is not canceled, <a href=#run-post-click-activation-steps>run post-click
activation steps</a> on the element.</p>

<p>If the event <em>is</em> canceled, the user agent must <a href=#run-canceled-activation-steps>run canceled activation
steps</a> on the element instead.</p>

</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

</ol><p>When a pointing device is clicked, the user agent must run these steps:</p>

<ol><li><p>If the element's <var title="">click in progress</var> flag is set to true, then abort
these steps.</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to true.</li>

<li><p>Let <var title="">e</var> be the <a href=#nearest-activatable-element>nearest activatable element</a> of the element
designated by the user (defined below), if any.</li>

<li><p>If there is an element <var title="">e</var>, <a href=#run-pre-click-activation-steps>run pre-click activation steps</a>
on it.</li>

<li>

<p><a href=#concept-event-dispatch title=concept-event-dispatch>Dispatch</a> the required <code title=event-click><a href=#event-click>click</a></code> event.</p> <!-- interaction event spec point -->

<p>If there is an element <var title="">e</var> and the <code title=event-click><a href=#event-click>click</a></code>
event is not canceled, <a href=#run-post-click-activation-steps>run post-click activation steps</a> on element <var title="">e</var>.</p>

<p>If there is an element <var title="">e</var> and the event <em>is</em> canceled, <a href=#run-canceled-activation-steps>run
canceled activation steps</a> on element <var title="">e</var>.</p>

</li>

<li><p>Set the <var title="">click in progress</var> flag on the element to false.</li>

</ol><p class=note>The algorithms above don't run for arbitrary synthetic events dispatched by author
script. The <code title=dom-click><a href=#dom-click>click()</a></code> method can be used to make the <a href=#run-synthetic-click-activation-steps>run
synthetic click activation steps</a> algorithm happen programmatically.</p>

<p class=note>Click-focusing behavior (e.g. the focusing of a text field when user clicks in
one) typically happens before the click, when the mouse button is first depressed, and is
therefore not discussed here.</p> <!-- interaction event spec point -->

<p>Given an element <var title="">target</var>, the <dfn id=nearest-activatable-element>nearest activatable element</dfn> is the
element returned by the following algorithm:</p>

<ol><li><p>If <var title="">target</var> has a defined <a href=#activation-behavior>activation behavior</a>, then return
<var title="">target</var> and abort these steps.</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.</li>

<li><p>Otherwise, there is no <a href=#nearest-activatable-element>nearest activatable element</a>.</li>

</ol><p>When a user agent is to <dfn id=run-pre-click-activation-steps>run pre-click activation steps</dfn> on an element, it must run
the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn> defined for that element, if any.</p>

<p>When a user agent is to <dfn id=run-canceled-activation-steps>run canceled activation steps</dfn> on an element, it must run the
<dfn id=canceled-activation-steps>canceled activation steps</dfn> defined for that element, if any.</p>

<p>When a user agent is to <dfn id=run-post-click-activation-steps>run post-click activation steps</dfn> on an element, it must run
the <dfn id=activation-behavior>activation behavior</dfn> defined for that element, if any. Activation behaviors can
refer to the <code title=event-click><a href=#event-click>click</a></code> event that was fired by the steps above
leading up to this point.</p>

</div>

<!--TOPIC:DOM APIs-->

<!-- v2 idea: HTMLImageElement.click(x, y); or clickPoint(), if click() can't be done in IE; can
this be emulated in IE by posting a synthetic mouse click event with those X and Y coords?
(ack Csaba Gabor)
Expand Down

0 comments on commit 65f0070

Please sign in to comment.