Fix onclick=form.submit(); onsubmit=return false to submit again (bug 192170), r=alexsavulov@netscape.com, sr=bzbarsky@mit.edu, a=asa

This commit is contained in:
jkeiser%netscape.com 2003-03-27 15:59:31 +00:00
Родитель 863a8d106e
Коммит e6dd75348e
2 изменённых файлов: 1 добавлений и 17 удалений

Просмотреть файл

@ -520,15 +520,6 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
case NS_MOUSE_LEFT_CLICK: case NS_MOUSE_LEFT_CLICK:
{ {
if (mForm) { if (mForm) {
if (mType == NS_FORM_BUTTON_SUBMIT) {
// tell the form to forget a possible pending submission.
// the reason is that the script returned true (the event was
// ignored) so if there is a stored submission, it will miss
// the name/value of the submitting element, thus we need
// to forget it and the form element will build a new one
mForm->ForgetPendingSubmission();
}
if (mType == NS_FORM_BUTTON_SUBMIT || mType == NS_FORM_BUTTON_RESET) { if (mType == NS_FORM_BUTTON_SUBMIT || mType == NS_FORM_BUTTON_RESET) {
nsFormEvent event; nsFormEvent event;
event.eventStructType = NS_FORM_EVENT; event.eventStructType = NS_FORM_EVENT;

Просмотреть файл

@ -1709,14 +1709,7 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
{ {
if (mForm && (oldType == NS_FORM_INPUT_SUBMIT || if (mForm && (oldType == NS_FORM_INPUT_SUBMIT ||
oldType == NS_FORM_INPUT_IMAGE)) { oldType == NS_FORM_INPUT_IMAGE)) {
if (mType == NS_FORM_INPUT_SUBMIT || mType == NS_FORM_INPUT_IMAGE) { if (mType != NS_FORM_INPUT_SUBMIT && mType != NS_FORM_INPUT_IMAGE) {
// tell the form to forget a possible pending submission.
// the reason is that the script returned true (the event was
// ignored) so if there is a stored submission, it will miss
// the name/value of the submitting element, thus we need
// to forget it and the form element will build a new one
mForm->ForgetPendingSubmission();
} else {
// If the type has changed to a non-submit type, then we want to // If the type has changed to a non-submit type, then we want to
// flush the stored submission if there is one (as if the submit() // flush the stored submission if there is one (as if the submit()
// was allowed to succeed) // was allowed to succeed)