<!DOCTYPE html>
<body>
<style>
button:disabled {
color: #aaa;
}
button {
-webkit-appearance: none;
}
</style>
<button onclick="this.disabled = true;">Button</button>
<script src="../../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
var button = document.querySelector('button');
button.focus();
shouldBe('document.activeElement', 'button');
debug('Clicking a button makes the button disabled.');
window.onload = function() {
button.addEventListener('blur', function() {
testPassed('blur event was disaptched.');
button.remove();
finishJSTest();
}, false);
// Need to wait until CheckFocusedElementTask is unqueued.
setTimeout(function() {
button.click();
document.body.offsetTop;
}, 20);
setTimeout(function() {
testFailed('No blur event.');
finishJSTest();
}, 2000);
};
</script>
</body>