From d4664221e7603ed16f280d5c6b1f497d34f26b3a Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Mon, 26 Jun 2023 18:03:29 +0100 Subject: [PATCH] add dialogmodaltarget attribute --- source | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 3 deletions(-) diff --git a/source b/source index 295577fcfa1..f2c738a13f5 100644 --- a/source +++ b/source @@ -45686,7 +45686,8 @@ interface HTMLInputElement : HTMLElement { // also has obsolete members }; -HTMLInputElement includes PopoverInvokerElement; +HTMLInputElement includes PopoverInvokerElement; +HTMLInputElement includes DialogInvokerElement;
Uses HTMLInputElement.
@@ -52101,7 +52102,8 @@ interface HTMLButtonElement : HTMLElement { readonly attribute NodeList labels; }; -HTMLButtonElement includes PopoverInvokerElement; +HTMLButtonElement includes PopoverInvokerElement; +HTMLButtonElement includes DialogInvokerElement;
Uses HTMLButtonElement.
@@ -60337,6 +60339,86 @@ interface HTMLDialogElement : HTMLElement { </dialog> +

The dialogmodal target attributes

+ +

Buttons may have the following content attributes:

+ + + +

If specified, the dialogmodaltarget attribute value must + be the ID of a dialog element + in the same tree as the button with the + dialogmodaltarget attribute.

+ +
+

The following shows how the dialogmodaltarget attribute + can be used to show and close a dialog:

+ +
<button dialogmodaltarget="foo">
+  Show a dialog (modal)
+</button>
+
+<dialog id="foo">
+  This is a dialog!
+  <button dialogmodaltarget="foo">Close</button>
+</article>
+
+ + DOM interface: +
interface mixin DialogInvokerElement {
+  [CEReactions] attribute Element? dialogModalTargetElement;
+};
+ +

The dialogModalTargetElement IDL attribute must + reflect the dialogmodaltarget attribute.

+ +

To run the dialog modal target attribute activation behavior given a Node + node:

+ +
    +
  1. Let dialog be node's dialog modal target element.

  2. + +
  3. If dialog is null, then return.

  4. + +
  5. If the open attribute is set on node + then: + +

      +
    1. Run close()

      on node
    2. +
    3. Otherwise, run showModal() on node

    4. +
    + +
  6. +
+ +

To get the dialog modal target element given a Node node, perform + the following steps. They return an HTML element or null.

+ +
    +
  1. If node is not a button, then return + null.

  2. + +
  3. If node is disabled, then return + null.

  4. + +
  5. If node has a form owner and node is a submit button, then return null.

  6. + +
  7. Let dialogElement be node's dialogmodaltarget-associated element.

  8. + +
  9. If dialogElement is null, then return null.

  10. + +
  11. If dialogElement is not a dialog element, then return null.

  12. + +
  13. Return dialogElement.

  14. +
+ + @@ -60365,7 +60447,6 @@ interface HTMLDialogElement : HTMLElement { -

The script element