In JSDom (v15.1.1), form.elements
does not include form elements defined outside the form hierarchy with attribute form='form-id'
.
The following form has an input element defined outside the hierarchy.
If we get document.forms[0].elements
, we expect a list containing one element. Instead, the list is empty.
<form id='test-form'></form>
<input type='text' name='test' form='test-form' />
See equivalent test in a browser: https://jsfiddle.net/fthompson/2njuLq3r/2/
Previous PRs add support for the form
attribute in some capacity, including support for submit buttons outside the form, but the previous PR apparently does not cover the full HTML spec.
Related issues:
jsdom/jsdom#765
jsdom/jsdom#2368