Skip to content

Commit

Permalink
Add onfocusin and onfocusout attribute event listeners
Browse files Browse the repository at this point in the history
Spec issue: whatwg/html#10234

Fixed: 330759712
Change-Id: I4103717056a6dfb6e216c44c26b0305d44c60f5f
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Mar 29, 2024
1 parent ac8b032 commit d269349
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions html/dom/elements/global-attributes/onfocusin-onfocusout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel=help href="https://github.com/whatwg/html/issues/10234">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div tabindex=0>focusable div</div>

<script>
const div = document.querySelector('div');

test(() => {
let firedFocusin = false;
div.onfocusin = () => firedFocusin = true;
div.focus();
assert_true(firedFocusin);
}, 'element.onfocusin should add a focusin event listener.');

test(() => {
div.focus();
let firedFocusout = false;
div.onfocusout = () => firedFocusout = true;
div.blur();
assert_true(firedFocusout);
}, 'element.onfocusout should add a focusout event listener.');
</script>

0 comments on commit d269349

Please sign in to comment.