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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>22135</bug_id>
          
          <creation_ts>2008-11-07 17:16:56 -0800</creation_ts>
          <short_desc>oninput doesn&apos;t work on divs</short_desc>
          <delta_ts>2009-07-11 08:52:21 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ojan Vafai">ojan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>ian</cc>
    
    <cc>shadow2531</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97988</commentid>
    <comment_count>0</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2008-11-07 17:16:56 -0800</bug_when>
    <thetext>The following HTML works in FF3 but not in webkit (as in, it alerts when you type in the input.

&lt;div oninput=alert(1)&gt;&lt;input&gt;&lt;/div&gt;

On the otherhand, listening to input events on the div via addEventListener does work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97999</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-08 01:46:13 -0800</bug_when>
    <thetext>Confirmed with r38232.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98225</commentid>
    <comment_count>2</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-11-10 16:26:53 -0800</bug_when>
    <thetext>According to HTML5, all of these on* are defined for all HTML elements:
http://www.whatwg.org/specs/web-apps/current-work/#event-handler-attributes

However, HTML5 does not mention &quot;oninput&quot; in its list.  We could pick on hixie to add it (or better yet, ask on the whatwg list).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98226</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2008-11-10 16:28:16 -0800</bug_when>
    <thetext>To quote HTML5: &quot;The following are the event handler attributes that must be supported by all HTML elements, as both content attributes and DOM attributes, and on Window objects, as DOM attributes:&quot;
and then proceeds to list a bunch (not including oninput).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125469</commentid>
    <comment_count>4</comment_count>
    <who name="Michael A. Puls II">shadow2531</who>
    <bug_when>2009-06-12 06:48:33 -0700</bug_when>
    <thetext>For the input element, there&apos;s a table showing for what @type of input element fires &apos;input&apos;: &lt;http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-input-element&gt; (scroll down a bit to see the table)

input event:
&lt;http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#event-input-input&gt;

Under the textarea section, look for &quot;fire a simple event called input&quot;
&lt;http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#the-textarea-element&gt;

With that said, @oninput doesn&apos;t seem to be in the spec anywhere *yet*. But, I was under the assumption that &apos;input&apos; should only work for text fields (and maybe other elements in contentEditable mode).

I had no idea that
&lt;div oninput=&quot;alert(event.target)&quot;&gt;&lt;input&gt;&lt;/div&gt;
and
&lt;div&gt;&lt;input oninput=&quot;alert(event.target)&quot;&gt;&lt;/div&gt;
did the exact same thing.

That&apos;s weird. But, it seems to work in Opera too.

It seems like this would complicate things though as doing:

&lt;div oninput=&quot;alert(event.target)&quot;&gt;&lt;input&gt;&lt;input&gt;&lt;input&gt;&lt;textarea&gt;&lt;/textarea&gt;&lt;/div&gt;

would work like setting an &apos;input&apos; capture listener.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125648</commentid>
    <comment_count>5</comment_count>
    <who name="Michael A. Puls II">shadow2531</who>
    <bug_when>2009-06-13 11:11:25 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; To quote HTML5: &quot;The following are the event handler attributes that must be
&gt; supported by all HTML elements, as both content attributes and DOM attributes,
&gt; and on Window objects, as DOM attributes:&quot;
&gt; and then proceeds to list a bunch (not including oninput).
&gt; 

Sorry, I guess it&apos;s just like you said. Works for the &apos;change&apos; event too. You can do window.oniput = func, document.oninput = func and element.oninput = func (or use the addEventListener way or oninput= if the object is an element) and they&apos;ll be triggered by all descendants of that object that happen to fire &apos;input&apos; (like input elements and textareas etc).

Only thing is, window.addEventListener(&apos;input&apos; function(e){alert(e.currentTarget);}, false); will alert a window object in Firefox and a document object in Safari and Opera. That&apos;s for another bug though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126958</commentid>
    <comment_count>6</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-06-19 10:28:49 -0700</bug_when>
    <thetext>I fixed this with http://trac.webkit.org/changeset/44811</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127188</commentid>
    <comment_count>7</comment_count>
    <who name="Michael A. Puls II">shadow2531</who>
    <bug_when>2009-06-20 21:47:17 -0700</bug_when>
    <thetext>Yep. Works fine now in WebKit-r44837.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127202</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-06-21 01:10:29 -0700</bug_when>
    <thetext>Marking as fixed per the above.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>130990</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2009-07-10 15:45:29 -0700</bug_when>
    <thetext>oninput=&quot;&quot; shouldn&apos;t work in the example given above, because the &apos;input&apos; event doesn&apos;t bubble per spec.

Should I change the spec to make &apos;input&apos; bubble? I&apos;m pretty sure &apos;change&apos; doesn&apos;t bubble either, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>131112</commentid>
    <comment_count>10</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2009-07-11 08:52:21 -0700</bug_when>
    <thetext>This bug was really about supporting it via addEventListener, but not via oninput. 

Filed Bug 27176 about bubbling oninput.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>