Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset=utf-8>
<title>Selector: pseudo-classes (:focus for autofocus)</title>
<link rel="author" title="Kent Tamura" href="mailto:tkent@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
// This test can't be merged to focus.html because element.focus() may affect
// autofocus behavior.
var autofocusTest = async_test(":focus selector should work with an autofocused element.");
var input = document.createElement("input");
input.autofocus = true;
input.addEventListener("focus", function() {
autofocusTest.step(function() {
assert_array_equals(document.querySelectorAll(":focus"), [input])
autofocusTest.done();
});
}, false);
document.body.appendChild(input);
</script>
</body>