[Webkit-unassigned] [Bug 105697] New: Changing HTML content of <button> onchange of an <input> prevents a click from firing

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Dec 23 13:53:39 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=105697

           Summary: Changing HTML content of <button> onchange of an
                    <input> prevents a click from firing
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.8
            Status: UNCONFIRMED
          Severity: Minor
          Priority: P2
         Component: HTML Events
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: tj.vantoll at gmail.com


See the following code example (or see it live at http://jsfiddle.net/tj_vantoll/sNa3R/).

<!DOCTYPE html>
<html>
<head></head>
<body>

    <button>Initial</button>
    <input>

    <script>
        var button = document.getElementsByTagName('button')[0];
        var input = document.getElementsByTagName('input')[0];

        button.addEventListener('click', function() {
            alert('click');
        });

        input.addEventListener('change', function() {
            button.innerHTML = '<span>Changed</span>';
        });
    </script>

</body>
</html>

1) Type something in the textbox.
2) Without losing focus from the textbox click the button with the mouse.

Expected:
The click event to fire on the <button> and an alert to occur.  The alert does fire in the latest versions of Internet Explorer, Firefox, and Opera.

Actual:
The click event does not fire.

This only seems to happen when HTML content is injected.  If I set the innerHTML of the <button> to a plain string the issue does not occur.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list