[Bug 16332] New: stop propagation and canceled flags

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16332

           Summary: stop propagation and canceled flags
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
               URL: http://lists.w3.org/Archives/Public/www-dom/2011JanMar
                    /0054.html
        OS/Version: Windows NT
            Status: NEW
          Keywords: LC
          Severity: normal
          Priority: P2
         Component: DOM3 Events
        AssignedTo: travil@microsoft.com
        ReportedBy: travil@microsoft.com
         QAContact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, annevk@opera.com, www-dom@w3.org


PORTING separate issues from TRACKER, issue 186...
[Copied from http://lists.w3.org/Archives/Public/www-dom/2011JanMar/0054.html]

http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#event-flow 
says "As the final step of the event dispatch, for reasons of backwards  
compatibility, the implementation must reset the event object's  
internal-propagation and default-action-prevention states."

As far as I can tell this is not implemented this way. Propagation is not  
reset in either Opera or WebKit (it is in Gecko).

Load the following in  
http://software.hixie.ch/utilities/js/live-dom-viewer/ to test:

<!DOCTYPE html>
...<script>
   var e = document.createEvent("Event")
   e.initEvent("test", false, true)
   document.addEventListener("test", function() { w("invoked") }, false)
   e.stopPropagation();
   w("d1: " + document.dispatchEvent(e))
   w("d2: " + document.dispatchEvent(e))
</script>

Similarly, in Opera, WebKit or Gecko the canceled flag does not appear to  
be reset. Load the following in the same viewer to test:

<!DOCTYPE html>
...<script>
   function callback(ev) {
     if("defaultPrevented" in ev)
       w("ev: " + ev.defaultPrevented)
     else
       w("ev: " + ev.getPreventDefault())
   }
   var e = document.createEvent("Event")
   e.initEvent("test", false, true)
   document.addEventListener("test", callback, false)
   e.preventDefault();
   w("d1: " + document.dispatchEvent(e))
   w("d2: " + document.dispatchEvent(e))
</script>

So it appears that there is no backwards compatibility issue here.

Having said that, something to reset these flags might be nice so event  
objects can be reused. Or do we always want people to create new event  
objects? Maybe invoking initEvent() should reset these flags? As invoking  
initEvent() can also change the nature of it being cancelable.

Kind regards,


-- 
Anne van Kesteren
http://annevankesteren.nl/

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 12 March 2012 20:41:35 UTC