Skip to content

Commit

Permalink
call submit/reset from prototype in case they are masked
Browse files Browse the repository at this point in the history
fix #802
  • Loading branch information
ZekeLu committed Apr 27, 2021
1 parent 5b511f1 commit 6ba664d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
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

0 comments on commit 6ba664d

Please sign in to comment.