W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

[Bug 16332] New: stop propagation and canceled flags

From: <bugzilla@jessica.w3.org>
Date: Mon, 12 Mar 2012 20:41:32 +0000
To: www-dom@w3.org
Message-ID: <bug-16332-4009@http.www.w3.org/Bugs/Public/>

           Summary: stop propagation and canceled flags
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
               URL: http://lists.w3.org/Archives/Public/www-dom/2011JanMar
        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]

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>
   var e = document.createEvent("Event")
   e.initEvent("test", false, true)
   document.addEventListener("test", function() { w("invoked") }, false)
   w("d1: " + document.dispatchEvent(e))
   w("d2: " + document.dispatchEvent(e))

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>
   function callback(ev) {
     if("defaultPrevented" in ev)
       w("ev: " + ev.defaultPrevented)
       w("ev: " + ev.getPreventDefault())
   var e = document.createEvent("Event")
   e.initEvent("test", false, true)
   document.addEventListener("test", callback, false)
   w("d1: " + document.dispatchEvent(e))
   w("d2: " + document.dispatchEvent(e))

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

Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Monday, 12 March 2012 20:41:34 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:19 UTC