From a242392bd915d55840de6b13528491828c773346 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Tue, 14 May 2019 12:36:59 +0900 Subject: [PATCH 1/4] Add
's "firing submit event" flag This fixes https://github.com/whatwg/html/issues/4620 --- source | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/source b/source index 9203ba395db..f22d3efacc1 100644 --- a/source +++ b/source @@ -56036,6 +56036,9 @@ fur

Each form element has a constructing entry list boolean, initially false.

+

Each form element has a firing submit event boolean, initially + false.

+

When a form element form is submitted from an element submitter (typically a button), optionally with a submitted from -

  • If the submitted from submit() - method flag is not set, and the submitter element's no-validate state is false, then interactively - validate the constraints of form and examine the result: if the result - is negative (the constraint validation concluded that there were invalid fields and probably - informed the user of this) then fire an event named - invalid at the form element and then return.

  • -
  • If the submitted from submit() method flag is not set, then:

      +
    1. If form's firing submit event is true, then return.

    2. + +
    3. If the submitter element's + no-validate state is false, then + interactively validate the constraints of form and examine the result: + if the result is negative (the constraint validation concluded that there were invalid fields + and probably informed the user of this) then + fire an event named + invalid at the form element and then return. +

    4. + +
    5. Set form's firing submit event to true.

    6. +
    7. Let continue be the result of firing an event named submit at form, with the bubbles attribute initialized to true and the cancelable attribute initialized to true.

    8. +
    9. Set form's firing submit event to false.

    10. +
    11. If continue is false, then return.

    12. From 3f72681f94880e1cbe2246141679f027a66cf709 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 14 May 2019 13:19:54 -0400 Subject: [PATCH 2/4] Wrapping tweak. Also removes comments that are no longer helpful because the structure is now obvious from the actual spec text. --- source | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/source b/source index f22d3efacc1..47564556901 100644 --- a/source +++ b/source @@ -56058,8 +56058,6 @@ fur
    13. Let form browsing context be the browsing context of form document.

    14. - -
    15. If the submitted from submit() method flag is not set, then: @@ -56067,20 +56065,18 @@ fur

      1. If form's firing submit event is true, then return.

      2. -
      3. If the submitter element's - no-validate state is false, then - interactively validate the constraints of form and examine the result: - if the result is negative (the constraint validation concluded that there were invalid fields - and probably informed the user of this) then - fire an event named - invalid at the form element and then return. -

      4. +
      5. If the submitter element's no-validate + state is false, then interactively validate the constraints of + form and examine the result: if the result is negative (the constraint validation + concluded that there were invalid fields and probably informed the user of this) then fire an event named invalid at the form element and then return.

      6. Set form's firing submit event to true.

      7. Let continue be the result of firing an - event named submit at form, with the - bubbles attribute initialized to true and the named submit at form, with the bubbles attribute initialized to true and the cancelable attribute initialized to true.

      8. Set form's firing submit event to false.

      9. @@ -56094,11 +56090,7 @@ fur data-x="event-submit">submit
        event could have changed the outcome.

      - - - - +
    16. Let encoding be the result of picking an encoding for the form.

      From fba38af4c9d5ac3ce4de6bcae4d3ace3abb42944 Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Wed, 15 May 2019 09:35:06 +0900 Subject: [PATCH 3/4] - Protect interactive validation too - Rename the flag; firing submit event -> firing submission events --- source | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source b/source index 47564556901..2f6ed787561 100644 --- a/source +++ b/source @@ -56036,7 +56036,7 @@ fur

      Each form element has a constructing entry list boolean, initially false.

      -

      Each form element has a firing submit event boolean, initially +

      Each form element has a firing submission events boolean, initially false.

      When a form element form is -

    17. If form's firing submit event is true, then return.

    18. +
    19. If form's firing submission events is true, then + return.

    20. + +
    21. Set form's firing submission events to true.

    22. If the submitter element's no-validate state is false, then interactively validate the constraints of @@ -56072,14 +56075,12 @@ fur data-x="concept-event-fire">fire an event named invalid at the form element and then return.

    23. -
    24. Set form's firing submit event to true.

    25. -
    26. Let continue be the result of firing an event named submit at form, with the bubbles attribute initialized to true and the cancelable attribute initialized to true.

    27. -
    28. Set form's firing submit event to false.

    29. +
    30. Set form's firing submission events to false.

    31. If continue is false, then return.

    32. From b12c1a87f3309b31d1ae9796b1ce1ba3ad47d481 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 15 May 2019 14:19:54 -0400 Subject: [PATCH 4/4] Also reset there --- source | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/source b/source index 2f6ed787561..61805010afb 100644 --- a/source +++ b/source @@ -56068,12 +56068,22 @@ fur
    33. Set form's firing submission events to true.

    34. -
    35. If the submitter element's no-validate - state is false, then interactively validate the constraints of - form and examine the result: if the result is negative (the constraint validation - concluded that there were invalid fields and probably informed the user of this) then fire an event named invalid at the form element and then return.

    36. +
    37. +

      If the submitter element's no-validate + state is false, then interactively validate the constraints of + form and examine the result. If the result is negative (i.e., the constraint + validation concluded that there were invalid fields and probably informed the user of this), + then:

      + +
        +
      1. Fire an event named invalid at the form element.

      2. + +
      3. Set form's firing submission events to false.

      4. + +
      5. Return.

      6. +
      +
    38. Let continue be the result of firing an event named submit at form, with the