ACTION-62: Define how to determine receiver property of each instance of a UIRequestEvent.
authorJames Craig <jcraig@apple.com>
Wed, 10 Jul 2013 18:02:25 -0700
changeset 120 10e0d452f2e1
parent 119 a6e4826cd246
child 121 bab7f6fc4ab8
ACTION-62: Define how to determine receiver property of each instance of a UIRequestEvent.
src/indie-ui-events.html
--- a/src/indie-ui-events.html	Wed Jul 10 16:34:20 2013 -0700
+++ b/src/indie-ui-events.html	Wed Jul 10 18:02:25 2013 -0700
@@ -282,11 +282,23 @@
 			<section id="UIRequestEvent" class="normative">
 				<h3>Interface UIRequestEvent</h3>
 				<p class="ednote">Separate interface from UIEvent because the @uiactions attribute will 1) affect when and where these events are fired, and 2) adds the distinction of an event <a href="#def_request_event_receiver">receiver</a> element (element declaring the uiactions attribute) in addition to the "target" element where the event initiates and the "listener" element where the event is registered for and handled.</p>
+				<p>The <code>receiver</code> attribute of each instance of the Event interface MUST return an EventTarget matching the DOMElement where the corresponding event's action is declared via the <a href="#uiactions-attribute"><code>uiactions</code> attribute</a>.</p>
 				<dl title="[Constructor(DOMString typeArg, optional UIRequestEventInit dictUIRequestEventInit)] interface UIRequestEvent : UIEvent" class="idl">
 					<dt>readonly attribute EventTarget receiver</dt>
 					<dd>In addition to the event target, each UI Request Event has a receiver element, which is declared via the <a href="#uiactions-content-attribute"><code>uiactions</code></a> content attribute on an ancestor node of the event target. </dd>
 				</dl>
 				
+				<section id="determining_event_receiver">
+					<h2>Determining the Event Receiver</h2>
+					<p>The event receiver is determined using the following steps:</p>
+					<ol>
+						<li>For each event name literal (e.g. <code>"dismissrequest"</code>), determine the corresponding uiactions token (e.g. <code>"dismiss"</code>).</li>
+						<li>Starting with the event's target element, determine if the element's actions list contains the corresponding action for the event (e.g. <code>el.uiactions.contains("dismiss")</code>). If the current element's action list contains the corresponding uiactions token, the event target is also the event receiver.</li>
+						<li>If the current element's action list does not contain the corresponding uiactions token, move up to the parent element and try again. Continue until reaching the root element. The closest ancestor to match the corresponding action token is the event receiver.</li>
+						<li>If the event receiver is still undetermined upon reaching the root element, stop. There is no valid event receiver and the user agent MUST NOT initiate the event.</li>
+					</ol>
+				</section>
+
 				<div class="ednote">
 					<p>May also need a way to associate IndieUI events with their physical event counterparts.</p>
 					<pre>[Example]
@@ -764,6 +776,7 @@
 				<li>05 Jun 2013: changeType and focusType are unsigned shorts and not nullable. Added UNKNOWN = 0 constants to account for the change. Removed previous option for separate LinearFocusType and DirectionalFocusType dictionaries; these constants (NAV_NEXT, NAV_UP, etc.) are now defined in the constructor.</li>
 				<li>09 Jul 2013: The uiactions IDL attribute is now a DOMTokenList rather than a DOMString.</li>
 				<li>10 Jul 2013: Added section defining strings for DOMImplementation.hasFeature().</li>
+				<li>10 Jul 2013: Added steps to determine the event receiver.</li>
 			</ul>
 		</section>
 		<section id="terms" class="appendix" data-include="./include/terms.html"></section>