onblur-remove.html   [plain text]

        var numBlurs = 0;

        function debug(str) {
            var c = document.getElementById('console')
            c.innerHTML += str + "<br>"


        function finish() {
            var f = document.getElementById('f')

            f.innerHTML = '';

            if (numBlurs)
                debug('FAILURE: Onblur handler called!')
    <p>This tests that elements shouldn't emit any onblur events when they are being removed from the document. To test this, click inside the input field. If If this test is successful, "SUCCESS" should be shown below, otherwise "FAILURE" is shown.</p>
    <form id='f'>
      <input onblur="numBlurs++" onfocus="setTimeout('finish()', 0)">
    <pre id="console"></pre>