<?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>7626</bug_id>
          
          <creation_ts>2009-09-15 10:26:56 +0000</creation_ts>
          <short_desc>Spec says: &quot;Note: Removing an event handler content attribute does not reset the corresponding event handler attribute.&quot;. In fact browsers will remove or &quot;deactivate&quot; the listener when you remove the HTML attribute. Some browsers reset it to null or undef</short_desc>
          <delta_ts>2010-10-04 14:29:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#events</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>LC</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>hsteen</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>27171</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2009-09-15 10:26:56 +0000</bug_when>
    <thetext>Section: http://www.whatwg.org/specs/web-apps/current-work/#events

Comment:
Spec says: &quot;Note: Removing an event handler content attribute does not reset the corresponding event handler attribute.&quot;. In fact browsers will remove or &quot;deactivate&quot; the listener when you remove the HTML attribute. Some browsers reset it to null or undefined, some don&apos;t but Gecko/IE/WebKit agree on not firing events after removeAttribute() was called. (It&apos;s considered a bug in Opera that we differ). -- Hallvord

Posted from: 213.236.208.22</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27744</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-09-29 00:39:01 +0000</bug_when>
    <thetext>My testing disagrees:
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/245

What am I missing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27822</commentid>
    <comment_count>2</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2009-09-29 09:57:31 +0000</bug_when>
    <thetext>I guess onload might be special due to its set-on-body-mapped-to-window weirdness. Try e.g. onclick?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27826</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-09-29 10:10:58 +0000</bug_when>
    <thetext>onclick:
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/247
...still fires in at least Opera and Firefox.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27827</commentid>
    <comment_count>4</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2009-09-29 10:12:17 +0000</bug_when>
    <thetext>What browser did you test in btw? Seems to work as this bug claims it should work in Safari (though Safari on the computer I type this from may be a bit old).

Seems I can not reopen this bug but Ian - can you do a bit more testing? What happens for you on http://software.hixie.ch/utilities/js/live-dom-viewer/saved/248 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27828</commentid>
    <comment_count>5</comment_count>
    <who name="Hallvord R. M. Steen">hsteen</who>
    <bug_when>2009-09-29 10:19:11 +0000</bug_when>
    <thetext>thanks for answering the questions before I ask them :-)

Opera thinks it&apos;s a bug and intends to fix it. The reason is that we have received reports that not doing so can open up XSS holes if user input is parsed with a DOMParser and sanitised by walking the DOM and removing attributes and tags that are not whitelisted. I can not give you the source of this information because the vulnerability may still be live on some sites, but we think mirroring the listeners and the attributes as closely as legacy content will allow would be the most expected behaviour from an author point of view. I also believe that this is a relatively obscure corner case which is unlikely to cause compat problems (particularly since browsers already disagree).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27829</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-09-29 10:26:23 +0000</bug_when>
    <thetext>That&apos;s a good enough reason for me!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27830</commentid>
    <comment_count>7</comment_count>
    <who name="">contributor</who>
    <bug_when>2009-09-29 10:27:37 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r4050.
Check-in comment: Removing an event handler content attribute needs to clear out the event handler.
http://html5.org/tools/web-apps-tracker?from=4049&amp;to=4050
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27871</commentid>
    <comment_count>8</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2009-09-29 15:52:27 +0000</bug_when>
    <thetext>So I&apos;m confused.  In Gecko, the &lt;body&gt; examples all put stuff on the window, so that&apos;s presumably what you see going on.  This testcase:

&lt;!DOCTYPE html&gt;
&lt;body&gt;
  &lt;p id=&quot;p&quot; onclick=&quot;&quot;&gt;click me&lt;/p&gt;
  &lt;script&gt;
    var p = document.getElementById(&quot;p&quot;);
    p.onclick = function() { alert(&apos;clicked&apos;); }
    p.removeAttribute(&quot;onclick&quot;);
  &lt;/script&gt;

doesn&apos;t show an alert when clicking on the text.  So is the point that the behavior for event listeners on &lt;body&gt; needs to match that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27888</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-09-29 22:32:39 +0000</bug_when>
    <thetext>Yeah, the spec now says that all event handler content attributes, on removal, clear out there corresponding backing event handlers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33453</commentid>
    <comment_count>10</comment_count>
    <who name="Maciej Stachowiak">mjs</who>
    <bug_when>2010-03-14 14:51:16 +0000</bug_when>
    <thetext>This bug predates the HTML Working Group Decision Policy.

If you are satisfied with the resolution of this bug, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
  http://dev.w3.org/html5/decision-policy/decision-policy.html

This bug is now being moved to VERIFIED. Please respond within two weeks. If this bug is not closed, reopened or escalated within two weeks, it may be marked as NoReply and will no longer be considered a pending comment.
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>