HTML forms are so broken.
With every other element, you can do this:
<div id="foo">
div.id // "foo"
Forms work the same way too:
<form id="bar">
form.id // "bar"
But then:
<form id="bar">
<input name="id">
form.id // the input element
🤡
I tried this just now in Chrome:
<form>
<input name="activeElement">
</form>
<script>
const form = document.querySelector('form')
console.log(form.activeElement) // input
console.log(document.activeElement) // body
</script>
How did you get activeElement to propagate?
Thanks, that was the missing piece of the puzzle ❤️ The DOM API still has a lot of darkness. I assume historical.
I quoted with correct info this time.