From 9050376fcd3b565b4281a4d1919cd56365eb1e0c Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Wed, 29 Jan 2025 09:50:42 +0000 Subject: [PATCH] separate out showModal steps into own algorithm --- source | 64 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/source b/source index 864a982e0de..957cdaf952a 100644 --- a/source +++ b/source @@ -61960,22 +61960,25 @@ interface HTMLDialogElement : HTMLElement {

The showModal() method steps are:

+ data-x="dom-dialog-showModal">showModal() method steps are to show a modal + dialog given this.

+ +

To show a modal dialog given a dialog element subject:

    -
  1. If this has an open attribute and - is modal of this is true, then return.

  2. +
  3. If subject has an open attribute and + is modal of subject is true, then return.

  4. -
  5. If this has an open attribute, then +

  6. If subject has an open attribute, then throw an "InvalidStateError" DOMException.

  7. -
  8. If this's node document is not fully active, then +

  9. If subject's node document is not fully active, then throw an "InvalidStateError" DOMException.

  10. -
  11. If this is not connected, then throw an +

  12. If subject is not connected, then throw an "InvalidStateError" DOMException.

  13. -
  14. If this is in the popover showing +

  15. If subject is in the popover showing state, then throw an "InvalidStateError" DOMException.

  16. @@ -61984,35 +61987,35 @@ interface HTMLDialogElement : HTMLElement { data-x="dom-Event-cancelable">cancelable attribute initialized to true, the oldState attribute initialized to "closed", and the newState - attribute initialized to "open" at this is false, then + attribute initialized to "open" at subject is false, then return.

    -
  17. If this has an open attribute, +

  18. If subject has an open attribute, then return.

  19. -
  20. If this is not connected, then return.

  21. +
  22. If subject is not connected, then return.

  23. -
  24. If this is in the popover showing +

  25. If subject is in the popover showing state, then return.

  26. Queue a dialog toggle event task given subject, "closed", and "open".

  27. -
  28. Add an open attribute to this, whose +

  29. Add an open attribute to subject, whose value is the empty string.

  30. -
  31. Set is modal of this to true.

  32. +
  33. Set is modal of subject to true.

  34. -
  35. Assert: this's node document's open +

  36. Assert: subject's node document's open dialogs list does not contain - this.

  37. + subject.

    -
  38. Add this to this's node document's open +

  39. Add subject to subject's node document's open dialogs list.

  40. -

    Let this's node document be blocked by the modal dialog this.

    +

    Let subject's node document be blocked by the modal dialog subject.

    This will cause the focused area of the document to become inert (unless that currently focused area is a @@ -62022,23 +62025,23 @@ interface HTMLDialogElement : HTMLElement { focus.

  41. -
  42. If this's node document's top layer does not - already contain this, then add an element - to the top layer given this.

  43. +
  44. If subject's node document's top layer does not + already contain subject, then add an element + to the top layer given subject.

  45. -
  46. Set the dialog close watcher with this.

  47. +
  48. Set the dialog close watcher with subject.

  49. -
  50. Set this's previously focused element to the +

  51. Set subject's previously focused element to the focused element.

  52. -
  53. Let document be this's node document.

  54. +
  55. Let document be subject's node document.

  56. Let hideUntil be the result of running topmost popover ancestor - given this, document's showing hint popover list, null, and + given subject, document's showing hint popover list, null, and false.

  57. If hideUntil is null, then set hideUntil to the result of running - topmost popover ancestor given this, document's + topmost popover ancestor given subject, document's showing auto popover list, null, and false.

  58. If hideUntil is null, then set hideUntil to @@ -62047,7 +62050,7 @@ interface HTMLDialogElement : HTMLElement {

  59. Run hide all popovers until given hideUntil, false, and true.

  60. -
  61. Run the dialog focusing steps given this.

  62. +
  63. Run the dialog focusing steps given subject.

To set the dialog close watcher, given a dialog @@ -62061,9 +62064,10 @@ interface HTMLDialogElement : HTMLElement {