New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html: Add a test for form.requestSubmit() #16743
Conversation
Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597
assert_throws(new TypeError(), () => { | ||
form.requestSubmit(submitButton); | ||
}); | ||
}, 'Passing a submit button not owned by the context object should throw'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The element isn't even in the same tree, here. There are other interesting tests as well.
- The control is a descendant, but has a
form
attribute overriding the form owner to a different form. - The control is a descendant, but has a
form
attribute that gives the control no form owner (e.g.form=""
) - The control is a descendant, but is actually owned by a different form by association from the parser. [1] or [2]
For each case, check that A.requestSubmit(control)
throws, and B.requestSubmit(control)
works.
[1] nested form actually owns the control
<!DOCTYPE html>
<form action=data:,A>
<div>
</form>
<form action=data:,B>
<input type=submit>
</form>
</div>
[2] the control is a descendant of the A form, not the B form, but is actually owned by B
<!DOCTYPE html>
<form action=data:,A>
<table>
</form>
<form action=data:,B>
<tr><td><input type=submit></td></tr>
</form>
</table>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a test of .form
IDL attribute, and IMO testing various patterns of .form
here isn't cost-effective. I added a few cases which ensures UAs don't apply simple ancestor check.
whatwg/html#4597 (comment) also seems interesting to test |
Added testcases based on whatwg/html#4621 . |
Closes #4187. Tests: web-platform-tests/wpt#16743.
Specification issue: whatwg/html#4187
Specification PR: whatwg/html#4597