VERIFIED FIXED 6731
REGRESSION: change event fires at load time for checked items
https://bugs.webkit.org/show_bug.cgi?id=6731
Summary REGRESSION: change event fires at load time for checked items
Dennis Rowe
Reported 2006-01-23 06:45:17 PST
It looks like if you have an onChange in a input and that button is "checked" the onChange code is run when the page is loaded. If I was to hazard a guess, the button is set up with the onChange hook attached to the button before the button is checked on the initial page load.
Attachments
Example of the given bug (208 bytes, text/html)
2006-01-23 06:47 PST, Dennis Rowe
no flags
fixes this by only sending the change event if the element is in a document (1.94 KB, patch)
2006-01-24 19:55 PST, Darin Adler
no flags
Another example of the bug (355 bytes, text/html)
2006-01-25 07:05 PST, Dennis Rowe
no flags
patch to fix the remaining problem (4.64 KB, patch)
2006-01-25 09:43 PST, Darin Adler
mjs: review+
Dennis Rowe
Comment 1 2006-01-23 06:47:36 PST
Created attachment 5871 [details] Example of the given bug This html causes the page to continously reload the page. It is a reduced version of the bug.
Dennis Rowe
Comment 2 2006-01-23 06:54:39 PST
The error occurs on the latest nightly build, but does not occur on the current stable version for Mac OSX 10.4, Version 2.0.3 (417.8).
Joost de Valk (AlthA)
Comment 3 2006-01-23 07:03:28 PST
This is indeed a regression, marking as such, adding keyword, making P1 because of it. This is also a HitListCandidate. I'm guessing component is forms, but not sure, could be javascript too, wouldn't know where to solve this.
Darin Adler
Comment 4 2006-01-24 19:55:50 PST
Created attachment 5936 [details] fixes this by only sending the change event if the element is in a document
Adele Peterson
Comment 5 2006-01-24 22:53:49 PST
Comment on attachment 5936 [details] fixes this by only sending the change event if the element is in a document r=me
Dennis Rowe
Comment 6 2006-01-25 07:03:49 PST
I downloaded and compile webkit today. The patch fixed the problem for the given test case, but the problem still comes up a nearly identical test case. I will reopen and attach second test case.
Dennis Rowe
Comment 7 2006-01-25 07:05:26 PST
Created attachment 5945 [details] Another example of the bug Here is an example of the bug showing up in a nearly identical case.
Dennis Rowe
Comment 8 2006-01-25 07:18:29 PST
The second test case is a bit strange. The name of the inputs are the same and when two inputs with the same name are "checked" it causes the onChange to fire. I don't know if this is the way it should work or not. It seems a bit strange that the onChange would be tied to the name instead of the actual input button, but I am really at a loss here.
Darin Adler
Comment 9 2006-01-25 09:20:05 PST
In the new example, the change event is firing because of the fact that parsing the second item causes the first one to be unchecked. It's the "unchecking" of the first item (which is already in the document) that is the change being reported.
Darin Adler
Comment 10 2006-01-25 09:38:12 PST
Comment on attachment 5936 [details] fixes this by only sending the change event if the element is in a document Clearing the review flag off this already-landed patch so this bug doesn't show up in the "ready to commit" queue.
Darin Adler
Comment 11 2006-01-25 09:43:58 PST
Created attachment 5947 [details] patch to fix the remaining problem
Maciej Stachowiak
Comment 12 2006-01-25 20:40:28 PST
Comment on attachment 5947 [details] patch to fix the remaining problem r=me
Dennis Rowe
Comment 13 2006-01-27 06:43:53 PST
I downloaded the source and compiled it and tested it against the reduced test cases and also against the case that the reduced test came from. In both cases the new patch worked as it should. Thanks!
Eric Seidel (no email)
Comment 14 2006-01-31 21:20:56 PST
Removing Regression keyword from bugs already fixed.
Note You need to log in before you can comment on or make changes to this bug.