<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16339</bug_id>
          
          <creation_ts>2012-03-12 21:50:20 +0000</creation_ts>
          <short_desc>Some comments on Basic Event Interfaces</short_desc>
          <delta_ts>2012-04-07 00:29:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - DOM3 Events</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0131.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>LC, needsReview</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Travis Leithead [MSFT]">travil</reporter>
          <assigned_to name="Travis Leithead [MSFT]">travil</assigned_to>
          <cc>annevk</cc>
    
    <cc>mike</cc>
    
    <cc>Ms2ger</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>65413</commentid>
    <comment_count>0</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-03-12 21:50:20 +0000</bug_when>
    <thetext>This is a PORT of TRACKER, ISSUE-186 (DOM3Events Outstanding Issues)
https://www.w3.org/2008/webapps/track/issues/186
[see http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0131.html]

Hi Doug, Jacob

Reading through the D3E section on Basic Event Interfaces, I found a 
number of things that could benefit from clarification.

4.1 Interface Event
===================

&gt; An object which implements the Event interface must be passed as the
&gt; parameter to an EventListener.

Interfaces don&apos;t have parameters, and this seems like a strange place to 
put this requirement.

eventPhase:

&gt; Used to indicate which phase of event flow is currently being
&gt; accomplished.

There must be a better word than &quot;accomplished&quot; that could be used here.

type:

&gt; The name must be a DOMString.

Redundant with the IDL.

initEvent:

&gt; This method sets the Event.type attribute to eventTypeArg.

Either this is redundant with the &quot;Parameters&quot; section below, or the 
respective requirements for bubbles and cancelable are missing.

4.2 Interface CustomEvent
=========================

initCustomEvent:

&gt; detailArg of type any
&gt;     Specifies CustomEvent.detail. This value may be null.

This last sentence is redundant with the type of the argument.

4.3 Interface EventTarget
=========================

&gt; The EventTarget interface must be implemented by all the objects
&gt; which could be event targets in an implementation which supports an
&gt; event flow.

This is unimplementable without a normative description of &quot;all the 
objects which could be event targets in an implementation which supports 
an event flow&quot;. I suggest leaving this up to the specifications that 
define event targets, as happens in practice.

addEventListener:

&gt; If listener is a function that also has a handleEvent method, the
&gt; function itself must be used as the callback and not its handleEvent
&gt; method.

This is redundant with the previous sentence, so should be a note and 
should not use &quot;must&quot;.

&gt; Note: If the listener is a function, then it may be a reference to a
&gt; function object or an inline function object literal.

I&apos;m not sure what this is supposed to mean.

About useCapture:

&gt; This parameter may be optional, on an implementation-specific basis.

This should be a &quot;must&quot; unless there is a very good reason against that.

&gt; Note: For programming languages which do not allow optional method
&gt; parameters, such as Java, the implementation may provide two
&gt; EventTarget.addEventListener methods, one with 2 parameters, and one
&gt; with 3 parameters.

Is this a note or is it normative? You can&apos;t have both.

removeEventListener:

Same comments, and

&gt; If a listener was registered twice, once for the capture and target
&gt; phases and once for the target and bubbling phases, each must be
&gt; removed separately.

It&apos;s not clear if this is a UA requirement.

4.4 Interface EventListener
===========================

EventListener
-------------

&gt; The EventListener interface is the primary way to handle events.
&gt; Content authors must define on object, such as a function, which the
&gt; EventListener interface and register their event listener on an
&gt; EventTarget.

I don&apos;t believe this is correct English.

&gt; The content authors should also remove their EventListener from its
&gt; EventTarget after they have completed using the listener.

I wonder why this is a &quot;should&quot;.

&gt; Copying a Node, with methods such as Node.cloneNode or
&gt; Range.cloneContents, must not copy the event listeners attached to
&gt; it. Event listeners must be attached to the newly created Node
&gt; afterwards, if so desired.

And why this is a &quot;must&quot;.

&gt; Moving a Node, with methods Document.adoptNode, Node.appendChild, or
&gt; Range.extractContents, must not affect the event listeners attached
&gt; to it.

You seem to have missed &quot;such as&quot; here.

It also seems like a reference to a DOM Range specification is missing.

EventException
--------------

First, I think there is no need for a separate exception interface for
two single-use exception codes.

Second,

&gt; Event operations may throw an EventException as specified in their
&gt; method descriptions.

uses &quot;may&quot; inappropriately.

Third, the &quot;code&quot; attribute is not actually defined in the prose.

Fourth, it makes little sense to put this in §4.4 &quot;Interface
EventListener&quot;. I would suggest a separate section.

4.5 Interface DocumentEvent
===========================

The description of createEvent&apos;s eventInterface argument has:

&gt; If the Event is to be dispatched via the EventTarget.dispatchEvent()
&gt; method, the appropriate event initialization method must be called
&gt; after creation in order to initialize the Event&apos;s values.

This suggests that the user agent must call initEvent, which I assume 
isn&apos;t the goal here.

&gt; For backward compatibility reason, …

&quot;reasons&quot;

&gt; If the parameter does not match an event interface name supported by
&gt; the implementation, the implementation must raise a NOT_SUPPORTED_ERR
&gt; DOMException

Missing period at the end of the sentence, and redundant with the 
&quot;Exceptions&quot; section below.

4.5.1 Event creation
====================

&gt; The Event objects created must be known by the DOM Events
&gt; implementation; otherwise an event exception must be thrown.

I&apos;m not sure what this means. In any case, it should be specified which 
exception is meant.

HTH
Ms2ger</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66496</commentid>
    <comment_count>1</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-04-07 00:29:42 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; This is a PORT of TRACKER, ISSUE-186 (DOM3Events Outstanding Issues)
&gt; https://www.w3.org/2008/webapps/track/issues/186
&gt; [see http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0131.html]
&gt; 
&gt; Hi Doug, Jacob
&gt; 
&gt; Reading through the D3E section on Basic Event Interfaces, I found a 
&gt; number of things that could benefit from clarification.
&gt; 
&gt; 4.1 Interface Event
&gt; ===================
&gt; 
&gt; &gt; An object which implements the Event interface must be passed as the
&gt; &gt; parameter to an EventListener.
&gt; 
&gt; Interfaces don&apos;t have parameters, and this seems like a strange place to 
&gt; put this requirement.

Re-worded this in the spirit for which the original sentence was intended. It should now be more readable and more technically correct.


&gt; eventPhase:
&gt; 
&gt; &gt; Used to indicate which phase of event flow is currently being
&gt; &gt; accomplished.
&gt; 
&gt; There must be a better word than &quot;accomplished&quot; that could be used here.

Ha ha! Yeah, re-worked that sentence and linked to the propagation path info.


&gt; type:
&gt; 
&gt; &gt; The name must be a DOMString.
&gt; 
&gt; Redundant with the IDL.

Looks like this was fixed in some prior draft. At least I couldn&apos;t find that text.


&gt; initEvent:
&gt; 
&gt; &gt; This method sets the Event.type attribute to eventTypeArg.
&gt; 
&gt; Either this is redundant with the &quot;Parameters&quot; section below, or the 
&gt; respective requirements for bubbles and cancelable are missing.

Dropped the sentence. It was redundant.

 
&gt; 4.2 Interface CustomEvent
&gt; =========================
&gt; 
&gt; initCustomEvent:
&gt; 
&gt; &gt; detailArg of type any
&gt; &gt;     Specifies CustomEvent.detail. This value may be null.
&gt; 
&gt; This last sentence is redundant with the type of the argument.

Dropped it.


&gt; 4.3 Interface EventTarget
&gt; =========================
&gt; 
&gt; &gt; The EventTarget interface must be implemented by all the objects
&gt; &gt; which could be event targets in an implementation which supports an
&gt; &gt; event flow.
&gt; 
&gt; This is unimplementable without a normative description of &quot;all the 
&gt; objects which could be event targets in an implementation which supports 
&gt; an event flow&quot;. I suggest leaving this up to the specifications that 
&gt; define event targets, as happens in practice.

Agree. Dropped this sentence, leaving the explanitory sentence that follows.


&gt; addEventListener:
&gt; 
&gt; &gt; If listener is a function that also has a handleEvent method, the
&gt; &gt; function itself must be used as the callback and not its handleEvent
&gt; &gt; method.
&gt; 
&gt; This is redundant with the previous sentence, so should be a note and 
&gt; should not use &quot;must&quot;.

Dropped the redundant sentence.


&gt; &gt; Note: If the listener is a function, then it may be a reference to a
&gt; &gt; function object or an inline function object literal.
&gt; 
&gt; I&apos;m not sure what this is supposed to mean.

I removed this. I think it was supposed to be describing lambda (or anonymous) functions versus function pointers. It&apos;s irrelevant to the spec.


&gt; About useCapture:
&gt; 
&gt; &gt; This parameter may be optional, on an implementation-specific basis.
&gt; 
&gt; This should be a &quot;must&quot; unless there is a very good reason against that.

Updated.


&gt; &gt; Note: For programming languages which do not allow optional method
&gt; &gt; parameters, such as Java, the implementation may provide two
&gt; &gt; EventTarget.addEventListener methods, one with 2 parameters, and one
&gt; &gt; with 3 parameters.
&gt; 
&gt; Is this a note or is it normative? You can&apos;t have both.

This was fixed in a prior revision of the document, apparently.


&gt; removeEventListener:
&gt; 
&gt; Same comments, and
&gt; 
&gt; &gt; If a listener was registered twice, once for the capture and target
&gt; &gt; phases and once for the target and bubbling phases, each must be
&gt; &gt; removed separately.
&gt; 
&gt; It&apos;s not clear if this is a UA requirement.

I added the UA requirement text.


&gt; 4.4 Interface EventListener
&gt; ===========================
&gt; 
&gt; EventListener
&gt; -------------
&gt; 
&gt; &gt; The EventListener interface is the primary way to handle events.
&gt; &gt; Content authors must define on object, such as a function, which the
&gt; &gt; EventListener interface and register their event listener on an
&gt; &gt; EventTarget.
&gt; 
&gt; I don&apos;t believe this is correct English.

I fixed this in a previous update.


&gt; &gt; The content authors should also remove their EventListener from its
&gt; &gt; EventTarget after they have completed using the listener.
&gt; 
&gt; I wonder why this is a &quot;should&quot;.
 
Also fixed in a previous update. Yes, the wording was a hurdle...


&gt; &gt; Copying a Node, with methods such as Node.cloneNode or
&gt; &gt; Range.cloneContents, must not copy the event listeners attached to
&gt; &gt; it. Event listeners must be attached to the newly created Node
&gt; &gt; afterwards, if so desired.
&gt; 
&gt; And why this is a &quot;must&quot;.

Now a &quot;can&quot; statement.


&gt; &gt; Moving a Node, with methods Document.adoptNode, Node.appendChild, or
&gt; &gt; Range.extractContents, must not affect the event listeners attached
&gt; &gt; to it.
&gt; 
&gt; You seem to have missed &quot;such as&quot; here.

Got it now.


&gt; It also seems like a reference to a DOM Range specification is missing.

Added it. DOM L2 Range is OK for the purposes of these APIs.


&gt; 
&gt; EventException
&gt; --------------
&gt; 
&gt; First, I think there is no need for a separate exception interface for
&gt; two single-use exception codes.
&gt; 
&gt; Second,
&gt; 
&gt; &gt; Event operations may throw an EventException as specified in their
&gt; &gt; method descriptions.
&gt; 
&gt; uses &quot;may&quot; inappropriately.
&gt; 
&gt; Third, the &quot;code&quot; attribute is not actually defined in the prose.
&gt; 
&gt; Fourth, it makes little sense to put this in §4.4 &quot;Interface
&gt; EventListener&quot;. I would suggest a separate section.

I&apos;ve previously deleted this entire section. In the conversion to WebIDL :)



&gt; 4.5 Interface DocumentEvent
&gt; ===========================
&gt; 
&gt; The description of createEvent&apos;s eventInterface argument has:
&gt; 
&gt; &gt; If the Event is to be dispatched via the EventTarget.dispatchEvent()
&gt; &gt; method, the appropriate event initialization method must be called
&gt; &gt; after creation in order to initialize the Event&apos;s values.
&gt; 
&gt; This suggests that the user agent must call initEvent, which I assume 
&gt; isn&apos;t the goal here.

Re-phrased this into a Note.

&gt; &gt; For backward compatibility reason, …
&gt; 
&gt; &quot;reasons&quot;

This was previously fixed :-)

 
&gt; &gt; If the parameter does not match an event interface name supported by
&gt; &gt; the implementation, the implementation must raise a NOT_SUPPORTED_ERR
&gt; &gt; DOMException
&gt; 
&gt; Missing period at the end of the sentence, and redundant with the 
&gt; &quot;Exceptions&quot; section below.

This was re-written with the change to WebIDL exceptions previously.


&gt; 4.5.1 Event creation
&gt; ====================
&gt; 
&gt; &gt; The Event objects created must be known by the DOM Events
&gt; &gt; implementation; otherwise an event exception must be thrown.
&gt; 
&gt; I&apos;m not sure what this means. In any case, it should be specified which 
&gt; exception is meant.

This was redundant with the prior sentence under &quot;Exceptions&quot;. So I removed it. (The exception was NotSupportedError.)

&gt; 
&gt; HTH
&gt; Ms2ger

Yep. Thanks!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>