<?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>66907</bug_id>
          
          <creation_ts>2011-08-24 17:22:42 -0700</creation_ts>
          <short_desc>File input element does not fire onchange event when the selection changes a second time</short_desc>
          <delta_ts>2011-09-07 22:33:46 -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>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>63929</dup_id>
          
          <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>0</everconfirmed>
          <reporter>Mike.Fellows</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>shinyak</cc>
    
    <cc>tkent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>456547</commentid>
    <comment_count>0</comment_count>
      <attachid>105101</attachid>
    <who name="">Mike.Fellows</who>
    <bug_when>2011-08-24 17:22:42 -0700</bug_when>
    <thetext>Created attachment 105101
A reduced test case for displaying an input of type file&apos;s onchange event behaviour

If a file or set of files is selected via an input element of type file the onchange event will be fired for the first selection.  If a new set of files is selected, and the first file in the new file list is the same as the first file in the old file list the onchange event will not be fired.  Any additional information displayed by the input element about how many files are selected will change regardless of whether or not the onchange event is fired.  If the second selection does not have the same first file as the first selection the onchange event will fire as expected.


A step by step example for reproducing the problem:

1. Page is loaded, the Choose File button is clicked and the files selected are &quot;1.jpg, 2.jpg&quot;.  The input element lists &quot;2 files&quot; next to the Choose File button and the onchange event will be fired as expected.

2. The Choose File button is clicked a second time and the files selected are &quot;1.jpg, 2.jpg, 3.jpg, 4.jpg&quot;.  The input element now changes to list &quot;4 files&quot; next to the Choose File button but the onchange event will not be fired.


I&apos;ve attached a reduced test case to the issue the will display this behaviour.

I&apos;ve tested this in the following browsers:

Google Chrome Linux version 13.0.782.215, WebKit: 535.1 (branches/chromium/782@93192)
Google Chrome Windows version 13.0.782.215 WebKit: 535.1 (branches/chromium/782@93192)
Safari for Windows version 5.1 (7534.50) (WebKit: 534.50 according to the User Agent String)

I&apos;ve seen the same behaviour in a Chrome v 12 browser as well so I think the issue has been around for awhile.


According to the current draft html5 spec the change event should fire when the file list is changed by user input:

http://www.w3.org/TR/html5/common-input-element-attributes.html#event-input-change</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>463890</commentid>
    <comment_count>1</comment_count>
    <who name="Shinya Kawanaka">shinyak</who>
    <bug_when>2011-09-07 22:31:43 -0700</bug_when>
    <thetext>I couldn&apos;t repro this. I think this was fixed in r90438. See also https://bugs.webkit.org/show_bug.cgi?id=63929</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>463891</commentid>
    <comment_count>2</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2011-09-07 22:33:46 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 63929 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>105101</attachid>
            <date>2011-08-24 17:22:42 -0700</date>
            <delta_ts>2011-08-24 17:22:42 -0700</delta_ts>
            <desc>A reduced test case for displaying an input of type file&apos;s onchange event behaviour</desc>
            <filename>index-onchange.html</filename>
            <type>text/html</type>
            <size>2263</size>
            <attacher>Mike.Fellows</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwKICAgIFBVQk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