<?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>16336</bug_id>
          
          <creation_ts>2012-03-12 21:09:03 +0000</creation_ts>
          <short_desc>defaultPrevented and preventDefault() conflict</short_desc>
          <delta_ts>2012-05-05 19:08:53 +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/2011JanMar/0067.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>ojan</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>65398</commentid>
    <comment_count>0</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-03-12 21:09:03 +0000</bug_when>
    <thetext>defaultPrevented says it reflects whether preventDefault() has been  
invoked for the event whereas preventDefault() says it only has an effect  
if the event is in fact cancelable. I think this has led to different  
implementations of these features in e.g. Opera and Gecko.

In DOM Core defaultPrevented can only be true for cancelable events. (This  
is another reason why I changed initEvent() to also reset the &quot;canceled  
flag&quot; so that if you change an event from being cancelable to  
non-cancelable everything still makes sense.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65399</commentid>
    <comment_count>1</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-03-12 21:10:23 +0000</bug_when>
    <thetext>[see http://lists.w3.org/Archives/Public/www-dom/2011JanMar/0077.html]

This seems to match the WebKit behavior as well.

Test case I used to verify:
&lt;input id=foo&gt;
&lt;script&gt;
var foo = document.getElementById(&apos;foo&apos;);
foo.addEventListener(&apos;click&apos;, function(e)
{e.preventDefault();alert(e.defaultPrevented)});
foo.addEventListener(&apos;blur&apos;, function(e)
{e.preventDefault();alert(e.defaultPrevented)});
&lt;/script&gt;

This approach makes more sense to me since it gives more information to web
developers.

Ojan</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67191</commentid>
    <comment_count>2</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-04-30 22:24:09 +0000</bug_when>
    <thetext>I agree. I&apos;ll update the spec text so that defaultPrevented reflects the actual internal state of the event.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67199</commentid>
    <comment_count>3</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2012-04-30 23:10:43 +0000</bug_when>
    <thetext>Fixed in latest update.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67350</commentid>
    <comment_count>4</comment_count>
    <who name="Ms2ger">Ms2ger</who>
    <bug_when>2012-05-05 19:08:53 +0000</bug_when>
    <thetext>Added a test: http://dvcs.w3.org/hg/webapps/rev/f7745b53fc02</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>