Bug 170451

Summary: Radio button change event not firing
Product: [Applications] konqueror Reporter: Adam Spragg <adam>
Component: khtml formsAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: maksim
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Adam Spragg 2008-09-05 13:33:32 UTC
Version:           4.1.1 (using KDE 4.1.1)
OS:                Linux
Installed from:    Unlisted Binary Package

Loading the following HTML attaches a "change" event handler to the first radio button. This does not fire in Konqueror 4.1.1 (Debian experimental package 4:4.1.1-1) when the radio button is selected.

It does fire on Konqueror 3.5.9 and Iceweasel 3.0.1

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>test</title>
        <script type="text/javascript">
            function a() { alert('foo'); }
            function l() {
                var elem = document.getElementById("foo_0");
                if (!elem) {
                    alert('unknown element');
                }
                else if (!elem.addEventListener) {
                    alert('no addEventListener');
                }
                else {
                    elem.addEventListener("change", a, false);
                    alert('added event listener');
                }
            }
            window.addEventListener("load", l, false);
        </script>
    </head>
    <body>
        <form action="/">
            <div><input type="radio" name="foo" id="foo_0" value="0"></div>
            <div><input type="radio" name="foo" id="foo_1" value="1"></div>
            <div><input type="submit" name="Submit"></div>
        </form>
    </body>
</html>
Comment 1 Maksim Orlovich 2008-09-11 19:30:33 UTC
I actually have a fix in-progress for this....
Comment 2 Maksim Orlovich 2008-10-18 18:37:33 UTC
SVN commit 873059 by orlovich:

Rework how we do onchange for input/checkboxes, unbreaking it and simplifying things.
As we only want to fire it in response to user events, this just does it in defaultEventHandler.
Fixes kde-look wallaper settings, and along with Germain's previous fix this covers 
#165607, #170451. This also doesn't suffer from #148118

BUG:148118
BUG:165607
BUG:170451


 M  +8 -0      html/html_formimpl.cpp  
 M  +1 -12     rendering/render_form.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=873059
Comment 3 Maksim Orlovich 2008-10-18 18:39:16 UTC
SVN commit 873060 by orlovich:

Merged revision 873059:
Rework how we do onchange for input/checkboxes, unbreaking it and simplifying things.
As we only want to fire it in response to user events, this just does it in defaultEventHandler.
Fixes kde-look wallaper settings, and along with Germain's previous fix this covers 
#165607, #170451. This also doesn't suffer from #148118

BUG:148118
BUG:165607
BUG:170451

 M  +8 -0      html/html_formimpl.cpp  
 M  +1 -12     rendering/render_form.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=873060