Skip to content

Commit d466422

Browse files
committed
add dialogmodaltarget attribute
1 parent a05b1ce commit d466422

File tree

1 file changed

+84
-3
lines changed

1 file changed

+84
-3
lines changed

source

+84-3
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>
@@ -60337,6 +60339,86 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6033760339
&lt;/dialog></code></pre>
6033860340
</div>
6033960341

60342+
<h4 id="the-dialogmodal-target-attributes">The dialogmodal target attributes</h4>
60343+
60344+
<p><span data-x="concept-button">Buttons</span> may have the following content attributes:</p>
60345+
60346+
<ul>
60347+
<li><p><dfn element-attr for="html-global"><code
60348+
data-x="attr-dialogmodaltarget">dialogmoddaltarget</code></dfn></p></li>
60349+
</ul>
60350+
60351+
<p>If specified, the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute value must
60352+
be the <span data-x="concept-ID">ID</span> of a <span data-x="dialog">dialog</span> element
60353+
in the same <span>tree</span> as the <span data-x="concept-button">button</span> with the
60354+
<code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute.</p>
60355+
60356+
<div class="example">
60357+
<p>The following shows how the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute
60358+
can be used to show and close a dialog:</p>
60359+
60360+
<pre><code class="html">&lt;button dialogmodaltarget="foo">
60361+
Show a dialog (modal)
60362+
&lt;/button>
60363+
60364+
&lt;dialog id="foo">
60365+
This is a dialog!
60366+
&lt;button dialogmodaltarget="foo">Close&lt;/button>
60367+
&lt;/article></code></pre>
60368+
</div>
60369+
60370+
<span data-x="concept-element-dom">DOM interface</span>:
60371+
<pre><code class="idl">interface mixin <dfn interface>DialogInvokerElement</dfn> {
60372+
[<span>CEReactions</span>] attribute Element? <span data-x="dom-dialogModalTargetElement">dialogModalTargetElement</span>;
60373+
};</code></pre>
60374+
60375+
<p>The <dfn attribute for="HTMLElement"><code
60376+
data-x="dom-dialogModalTargetElement">dialogModalTargetElement</code></dfn> IDL attribute must
60377+
<span>reflect</span> the <code data-x="attr-dialogmodaltarget">dialogmodaltarget</code> attribute.</p>
60378+
60379+
<p>To run the <dfn>dialog modal target attribute activation behavior</dfn> given a <code>Node</code>
60380+
<var>node</var>:</p>
60381+
60382+
<ol>
60383+
<li><p>Let <var>dialog</var> be <var>node</var>'s <span>dialog modal target element</span>.</p></li>
60384+
60385+
<li><p>If <var>dialog</var> is null, then return.</p></li>
60386+
60387+
<li><p>If the <code data-x="attr-dialog-open">open</code> attribute is set on <var>node</var>
60388+
then:
60389+
60390+
<ol>
60391+
<li><p>Run <code data-x="dom-dialog-close">close()</code></p> on <var>node</var></li>
60392+
<li><p>Otherwise, run <code data-x="dom-dialog-showmodal">showModal()</code> on <var>node</var></li>
60393+
</ol>
60394+
60395+
</li>
60396+
</ol>
60397+
60398+
<p>To get the <dfn>dialog modal target element</dfn> given a <code>Node</code> <var>node</var>, perform
60399+
the following steps. They return an <span data-x="HTML elements">HTML element</span> or null.</p>
60400+
60401+
<ol>
60402+
<li><p>If <var>node</var> is not a <span data-x="concept-button">button</span>, then return
60403+
null.</p></li>
60404+
60405+
<li><p>If <var>node</var> is <span data-x="concept-fe-disabled">disabled</span>, then return
60406+
null.</p></li>
60407+
60408+
<li><p>If <var>node</var> has a <span>form owner</span> and <var>node</var> is a <span
60409+
data-x="concept-submit-button">submit button</span>, then return null.</p></li>
60410+
60411+
<li><p>Let <var>dialogElement</var> be <var>node</var>'s <span data-x="attr-associated
60412+
element"><code data-x="">dialogmodaltarget</code>-associated element</span>.</p></li>
60413+
60414+
<li><p>If <var>dialogElement</var> is null, then return null.</p></li>
60415+
60416+
<li><p>If <var>dialogElement</var> is not a <code data-x="dialog">dialog</code> element, then return null.</p></li>
60417+
60418+
<li><p>Return <var>dialogElement</var>.</p></li>
60419+
</ol>
60420+
60421+
6034060422

6034160423

6034260424

@@ -60365,7 +60447,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6036560447

6036660448
</div>
6036760449

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

0 commit comments

Comments
 (0)