Skip to content
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

call submit/reset from prototype in case they are masked by form controls #803

Merged
merged 1 commit into from Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions js.go
Expand Up @@ -47,10 +47,10 @@ const (
// submit function, returning true or false if the call was successful.
submitJS = `(function(a) {
if (a.nodeName === 'FORM') {
a.submit();
HTMLFormElement.prototype.submit.call(a);
return true;
} else if (a.form !== null) {
a.form.submit();
HTMLFormElement.prototype.submit.call(a.form);
return true;
}
return false;
Expand All @@ -60,10 +60,10 @@ const (
// reset function, returning true or false if the call was successful.
resetJS = `(function(a) {
if (a.nodeName === 'FORM') {
a.reset();
HTMLFormElement.prototype.reset.call(a);
return true;
} else if (a.form !== null) {
a.form.reset();
HTMLFormElement.prototype.reset.call(a.form);
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions testdata/form.html
Expand Up @@ -14,8 +14,8 @@
<input id="keyword" type="text" name="q" value="chromedp"/><br>
<input id="foo" type="text" name="foo" value="foo"/><br>
<textarea id="bar" rows="4" cols="50">bar</textarea><br>
<input id="btn1" type="reset" value="Reset">
<input id="btn2" type="submit" value="Submit">
<input id="btn1" name="reset" type="reset" value="Reset">
<input id="btn2" name="submit" type="submit" value="Submit">
<p id="inner-hidden">this is <span style="display: none;">hidden</span></p>
<p id="hidden" style="display: none;">hidden</p>
</form>
Expand Down