<?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>29375</bug_id>
          
          <creation_ts>2009-09-18 06:54:06 -0700</creation_ts>
          <short_desc>[Qt] JavaScript onClick() handler prevents onChange() handler from firing</short_desc>
          <delta_ts>2014-02-03 03:15:40 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Other</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Qt, QtTriaged</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tor Arne Vestbø">vestbo</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cmarcelo</cc>
    
    <cc>jesus</cc>
    
    <cc>kenneth</cc>
    
    <cc>laszlo.gombos</cc>
    
    <cc>oded</cc>
    
    <cc>robert</cc>
    
    <cc>s.mathur</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>148064</commentid>
    <comment_count>0</comment_count>
    <who name="Tor Arne Vestbø">vestbo</who>
    <bug_when>2009-09-18 06:54:06 -0700</bug_when>
    <thetext>This bug report originated from issue QTBUG-2322
&lt;http://bugreports.qt.nokia.com/browse/QTBUG-2322&gt;

--- Description ---

In the following snippet of HTML the onClicked/onChange handlers are called differently when entering text and then clicking on the button.

&lt;html&gt;
&lt;body&gt;
&lt;script&gt;
function onChange()
{
    alert(document.f1.t1.value);
}
function onClick()
{
    alert(&apos;onClick&apos;);
}
&lt;/script&gt;
&lt;FORM name=&quot;f1&quot;&gt;
&lt;INPUT type=text name=&quot;t1&quot; onChange=&quot;onChange()&quot;&gt; &lt;/INPUT&gt;
&lt;INPUT type=button name=&quot;b1&quot; value=button onClick=&quot;onClick()&quot;&gt; &lt;/INPUT&gt;
&lt;/FORM&gt;
&lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>168372</commentid>
    <comment_count>1</comment_count>
      <attachid>44232</attachid>
    <who name="Oded Arbel">oded</who>
    <bug_when>2009-12-03 05:42:35 -0800</bug_when>
    <thetext>Created attachment 44232
Test case in an HTML file

In the test case provided above (copied from the bug description), the text fields onchange event fires properly no matter where you click (on the button or not) but if you click on the button and the onchange event for the text field fires, then the onclick event for the button does not. You actually have to click again on the button to get the onclick event (in which case the text wasn&apos;t changed so the onchange event does not fire). It doesn&apos;t matter if the onchange handler returns true or not.

Tested on Chrome 4 and Chromium 4.0.262.0 .</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>168373</commentid>
    <comment_count>2</comment_count>
    <who name="Oded Arbel">oded</who>
    <bug_when>2009-12-03 05:44:17 -0800</bug_when>
    <thetext>I have a similar problem where if the button is pressed, then only the button&apos;s onclick handler is called and not the onchange handler.

When I tried to create a minimal test case for this bug, the behavior changed to this one, so I think there is a race condition here where one event handler precludes the other from firing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>168378</commentid>
    <comment_count>3</comment_count>
    <who name="Oded Arbel">oded</who>
    <bug_when>2009-12-03 05:53:18 -0800</bug_when>
    <thetext>Also, another interesting thing (sorry for the bug spam, but I just tested something else), is that onmousedown does not suffer from this problem - if you use onmousedown instead of onclick then both events fire normally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>197285</commentid>
    <comment_count>4</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2010-03-08 13:28:37 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Also, another interesting thing (sorry for the bug spam, but I just tested
&gt; something else), is that onmousedown does not suffer from this problem - if you
&gt; use onmousedown instead of onclick then both events fire normally.

I can&apos;t recreate this problem at all in QtLauncher. Have you tried it there?

This is what I did, in the order I did it - maybe I&apos;m misunderstanding the bug but it looks good to me:

Do: edit text field, click button
Result: Get Onclick and Onchange popup in that order.

Do: leave text alone, click button.
Result: get onclick popup only

Do: edit text again, click elsewhere on screen
Result: get onchange popup only

Do: leave text alone, click button.
Result: get onclick popup only

Do: edit text field again, click button
Result: Get Onclick and Onchange popup in that order.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200725</commentid>
    <comment_count>5</comment_count>
    <who name="Tor Arne Vestbø">vestbo</who>
    <bug_when>2010-03-17 06:31:28 -0700</bug_when>
    <thetext>Confirmed in QtLauncher with trunk. Both Chrome and Firefox has this behavior, but Safari does not:

1. Click the text field.
2. Enter text
3. Click the button

Safari gives you an alert for each of the two even handlers, onChange() and onClick(), but QtLauncher and Chrome does not</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>200731</commentid>
    <comment_count>6</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2010-03-17 06:48:35 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; Confirmed in QtLauncher with trunk. Both Chrome and Firefox has this behavior,
&gt; but Safari does not:
&gt; 
&gt; 1. Click the text field.
&gt; 2. Enter text
&gt; 3. Click the button
&gt; 
&gt; Safari gives you an alert for each of the two even handlers, onChange() and
&gt; onClick(), but QtLauncher and Chrome does not

Weird, I still can&apos;t reproduce this on QtLauncher (Kubuntu Karmic) in trunk.

I click on the input field, enter text, click the button and get two pop ups one for the OnClick and one displaying the text I entered.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>225793</commentid>
    <comment_count>7</comment_count>
    <who name="Jesus Sanchez-Palencia">jesus</who>
    <bug_when>2010-05-14 07:08:48 -0700</bug_when>
    <thetext>Reproduced on Snow Leopard with Qt 4.7 trunk (HEAD 03f8f1df0d88f5ffe0b3120cffce614cbeefdb70) and WebKit trunk (r59155).


(In reply to comment #5)
&gt; Safari gives you an alert for each of the two even handlers, onChange() and onClick(), but QtLauncher and Chrome does not

So we have different behaviors on different WebKit browsers. I was wondering if this is really a bug or not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>975081</commentid>
    <comment_count>8</comment_count>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2014-02-03 03:15:40 -0800</bug_when>
    <thetext>=== Bulk closing of Qt bugs ===

If you believe that this bug report is still relevant for a non-Qt port of webkit.org, please re-open it and remove [Qt] from the summary.

If you believe that this is still an important QtWebKit bug, please fill a new report at https://bugreports.qt-project.org and add a link to this issue. See http://qt-project.org/wiki/ReportingBugsInQt for additional guidelines.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>44232</attachid>
            <date>2009-12-03 05:42:35 -0800</date>
            <delta_ts>2009-12-03 05:42:35 -0800</delta_ts>
            <desc>Test case in an HTML file</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>314</size>
            <attacher name="Oded Arbel">oded</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5Pgo8c2NyaXB0PgpmdW5jdGlvbiBvbkNoYW5nZSgpCnsKICAgIGFsZXJ0KGRv
Y3VtZW50LmYxLnQxLnZhbHVlKTsKfQpmdW5jdGlvbiBvbkNsaWNrKCkKewogICAgYWxlcnQoJ29u
Q2xpY2snKTsKfQo8L3NjcmlwdD4KPEZPUk0gbmFtZT0iZjEiPgo8SU5QVVQgdHlwZT0idGV4dCIg
bmFtZT0idDEiIG9uQ2hhbmdlPSJvbkNoYW5nZSgpOyI+IDwvSU5QVVQ+CjxJTlBVVCB0eXBlPSJi
dXR0b24iIG5hbWU9ImIxIiB2YWx1ZT0iYnV0dG9uIiBvbkNsaWNrPSJvbkNsaWNrKCkiPiA8L0lO
UFVUPgo8L0ZPUk0+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>