Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 33a85df

Browse files
committedJun 26, 2023
add dialogmodaltarget attribute
1 parent a05b1ce commit 33a85df

File tree

1 file changed

+83
-2
lines changed

1 file changed

+83
-2
lines changed
 

‎source

+83-2
Original file line numberDiff line numberDiff line change
@@ -45686,7 +45686,8 @@ interface <dfn interface>HTMLInputElement</dfn> : <span>HTMLElement</span> {
4568645686

4568745687
// <a href="#HTMLInputElement-partial">also has obsolete members</a>
4568845688
};
45689-
<span>HTMLInputElement</span> includes <span>PopoverInvokerElement</span>;</code></pre>
45689+
<span>HTMLInputElement</span> includes <span>PopoverInvokerElement</span>;
45690+
<span>HTMLInputElement</span> includes <span>DialogInvokerElement</span>;</code></pre>
4569045691
</dd>
4569145692
<dd w-dev>Uses <code>HTMLInputElement</code>.</dd>
4569245693
</dl>
@@ -52101,7 +52102,8 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
5210152102

5210252103
readonly attribute <span>NodeList</span> <span data-x="dom-lfe-labels">labels</span>;
5210352104
};
52104-
<span>HTMLButtonElement</span> includes <span>PopoverInvokerElement</span>;</code></pre>
52105+
<span>HTMLButtonElement</span> includes <span>PopoverInvokerElement</span>;
52106+
<span>HTMLButtonElement</span> includes <span>DialogInvokerElement</span>;</code></pre>
5210552107
</dd>
5210652108
<dd w-dev>Uses <code>HTMLButtonElement</code>.</dd>
5210752109
</dl>
@@ -60365,6 +60367,85 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6036560367

6036660368
</div>
6036760369

60370+
<h4 id="the-dialogmodal-target-attributes">The dialogmodal target attributes</h4>
60371+
60372+
<p><span data-x="concept-button">Buttons</span> may have the following content attributes:</p>
60373+
60374+
<ul>
60375+
<li><p><dfn element-attr for="html-global"><code
60376+
data-x="attr-dialogmodaltarget">dialogmoddaltarget</code></dfn></p></li>
60377+
</ul>
60378+
60379+
<p>If specified, the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute value must
60380+
be the <span data-x="concept-ID">ID</span> of a <span data-x="dialog">dialog</span> element
60381+
in the same <span>tree</span> as the <span data-x="concept-button">button</span> with the
60382+
<code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute.</p>
60383+
60384+
<div class="example">
60385+
<p>The following shows how the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute
60386+
can be used to show and close a dialog:</p>
60387+
60388+
<pre><code class="html">&lt;button dialogmodaltarget="foo">
60389+
Show a dialog (modal)
60390+
&lt;/button>
60391+
60392+
&lt;dialog id="foo">
60393+
This is a dialog!
60394+
&lt;button dialogmodaltarget="foo">Close&lt;/button>
60395+
&lt;/article></code></pre>
60396+
</div>
60397+
60398+
<span data-x="concept-element-dom">DOM interface</span>:
60399+
<pre><code class="idl">interface mixin <dfn interface>DialogInvokerElement</dfn> {
60400+
[<span>CEReactions</span>] attribute Element? <span data-x="dom-dialogModalTargetElement">dialogModalTargetElement</span>;
60401+
};</code></pre>
60402+
60403+
<p>The <dfn attribute for="HTMLElement"><code
60404+
data-x="dom-dialogModalTargetElement">dialogModalTargetElement</code></dfn> IDL attribute must
60405+
<span>reflect</span> the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute.</p>
60406+
60407+
<p>To run the <dfn>dialog modal target attribute activation behavior</dfn> given a <code>Node</code>
60408+
<var>node</var>:</p>
60409+
60410+
<ol>
60411+
<li><p>Let <var>dialog</var> be <var>node</var>'s <span>dialog modal target element</span>.</p></li>
60412+
60413+
<li><p>If <var>dialog</var> is null, then return.</p></li>
60414+
60415+
<li><p>If the <code data-x="attr-dialog-open">open</code> attribute is set on <var>node</var>
60416+
then:
60417+
60418+
<ol>
60419+
<li><p>Run <code data-x="dom-dialog-close">close()</code></p> on <var>node</var></li>
60420+
<li><p>Otherwise, run <code data-x="dom-dialog-showmodal">showModal()</code> on <var>node</var></li>
60421+
</ol>
60422+
60423+
</li>
60424+
</ol>
60425+
60426+
<p>To get the <dfn>dialog modal target element</dfn> given a <code>Node</code> <var>node</var>, perform
60427+
the following steps. They return an <span data-x="HTML elements">HTML element</span> or null.</p>
60428+
60429+
<ol>
60430+
<li><p>If <var>node</var> is not a <span data-x="concept-button">button</span>, then return
60431+
null.</p></li>
60432+
60433+
<li><p>If <var>node</var> is <span data-x="concept-fe-disabled">disabled</span>, then return
60434+
null.</p></li>
60435+
60436+
<li><p>If <var>node</var> has a <span>form owner</span> and <var>node</var> is a <span
60437+
data-x="concept-submit-button">submit button</span>, then return null.</p></li>
60438+
60439+
<li><p>Let <var>dialogElement</var> be <var>node</var>'s <span data-x="attr-associated
60440+
element"><code data-x="">dialogmodaltarget</code>-associated element</span>.</p></li>
60441+
60442+
<li><p>If <var>dialogElement</var> is null, then return null.</p></li>
60443+
60444+
<li><p>If <var>dialogElement</var> is not a <code data-x="dialog">dialog</code> element, then return null.</p></li>
60445+
60446+
<li><p>Return <var>dialogElement</var>.</p></li>
60447+
</ol>
60448+
6036860449

6036960450
<h4 id="the-script-element">The <dfn
6037060451
id="script" element><code>script</code></dfn> element</h4>

0 commit comments

Comments
 (0)
Please sign in to comment.