@@ -62628,14 +62628,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6262862628 <li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to <span>this</span>, whose
6262962629 value is the empty string.</p></li>
6263062630
62631- <li><p><span>Assert</span>: <span>this</span>'s <span>node document</span>'s <span>open
62632- dialogs list</span> does not <span data-x="list contains">contain</span>
62633- <span>this</span>.</p></li>
62634-
62635- <li><p>Add <span>this</span> to <span>this</span>'s <span>node document</span>'s <span>open
62636- dialogs list</span>.</p></li>
62637-
62638- <li><p><span>Set the dialog close watcher</span> with <span>this</span>.</p></li>
62631+ <li><p><span>Assert</span>: <span>this</span>'s <span data-x="dialog-close-watcher">close
62632+ watcher</span> is not null.</p></li>
6263962633
6264062634 <li><p>Set <span>this</span>'s <span>previously focused element</span> to the
6264162635 <span>focused</span> element.</p></li>
@@ -62768,31 +62762,58 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6276862762
6276962763 <hr>
6277062764
62771- <p>The <code>dialog</code> <span>HTML element removing steps</span>, given <var>removedNode</var>
62772- and <var>oldParent </var>, are:</p>
62765+ <p>The <code>dialog</code> <span>HTML element insertion steps</span>, given
62766+ <var>insertedNode </var>, are:</p>
6277362767
6277462768 <ol>
62775- <li>
62776- <p>If <var>removedNode</var>'s <span data-x="dialog-close-watcher">close watcher</span> is not
62777- null, then:</p>
62769+ <li><p>If <var>insertedNode</var>'s <span>node document</span> is not <span>fully active</span>,
62770+ then return.</p></li>
6277862771
62779- <ol>
62780- <li><p><span data-x="close-watcher-destroy">Destroy</span> <var>removedNode</var>'s <span
62781- data-x="dialog-close-watcher">close watcher</span>.</p></li>
62772+ <li><p>If <var>insertedNode</var> has an <code data-x="attr-dialog-open">open</code> attribute
62773+ and is <span>connected</span>, then run the <span>dialog setup steps</span> given
62774+ <var>insertedNode</var>.</p></li>
62775+ </ol>
6278262776
62783- <li><p>Set <var>removedNode</var>'s <span data-x="dialog-close-watcher">close watcher</span> to
62784- null.</p></li>
62785- </ol>
62786- </li>
62777+ <p>The <code>dialog</code> <span>HTML element removing steps</span>, given <var>removedNode</var>
62778+ and <var>oldParent</var>, are:</p>
62779+
62780+ <ol>
62781+ <li><p>If <var>removedNode</var> has an <code data-x="attr-dialog-open">open</code> attribute,
62782+ then run the <span>dialog cleanup steps</span> given <var>removedNode</var>.</p></li>
6278762783
6278862784 <li><p>If <var>removedNode</var>'s <span>node document</span>'s <span>top layer</span> <span
6278962785 data-x="list contains">contains</span> <var>removedNode</var>, then <span>remove an element from
6279062786 the top layer immediately</span> given <var>removedNode</var>.</p></li>
6279162787
6279262788 <li><p>Set <span>is modal</span> of <var>removedNode</var> to false.</p></li>
62789+ </ol>
62790+
62791+ <p>The following <span data-x="concept-element-attributes-change-ext">attribute change
62792+ steps</span>, given <var>element</var>, <var>localName</var>, <var>oldValue</var>,
62793+ <var>value</var>, and <var>namespace</var> are used for <code>dialog</code> elements:</p>
62794+
62795+ <ol>
62796+ <li><p>If <var>namespace</var> is not null, then return.</p></li>
6279362797
62794- <li><p><span data-x="list remove">Remove</span> <var>removedNode</var> from
62795- <var>removedNode</var>'s <span>node document</span>'s <span>open dialogs list</span>.</p></li>
62798+ <li><p>If <var>localName</var> is not <code data-x="attr-dialog-open">open</code>, then
62799+ return.</p></li>
62800+
62801+ <li><p>If <var>element</var>'s <span>node document</span> is not <span>fully active</span>, then
62802+ return.</p></li>
62803+
62804+ <li><p>If <var>value</var> is null and <var>oldValue</var> is not null, then run the
62805+ <span>dialog cleanup steps</span> given <var>element</var>.</p></li>
62806+
62807+ <li>
62808+ <p>If <var>element</var> is not <span>connected</span>, then return.</p>
62809+
62810+ <p class=note>This ensures that the dialog setup steps are not run on nodes that are
62811+ disconnected, which would result in a <span>close watcher</span> being established. The
62812+ <span>dialog cleanup steps</span> need no such guard.</p>
62813+ </li>
62814+
62815+ <li><p>If <var>value</var> is not null and <var>oldValue</var> is null, then run the
62816+ <span>dialog setup steps</span> given <var>element</var>.</p></li>
6279662817 </ol>
6279762818
6279862819 <p>To <dfn>show a modal dialog</dfn> given a <code>dialog</code> element <var>subject</var> and an
@@ -62838,14 +62859,10 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6283862859 <li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to <var>subject</var>, whose
6283962860 value is the empty string.</p></li>
6284062861
62841- <li><p>Set <span>is modal</span> of <var>subject</var> to true.</p></li>
62842-
62843- <li><p><span>Assert</span>: <var>subject</var>'s <span>node document</span>'s <span>open
62844- dialogs list</span> does not <span data-x="list contains">contain</span>
62845- <var>subject</var>.</p></li>
62862+ <li><p><span>Assert</span>: <var>subject</var>'s <span data-x="dialog-close-watcher">close
62863+ watcher</span> is not null.</p></li>
6284662864
62847- <li><p>Add <var>subject</var> to <var>subject</var>'s <span>node document</span>'s <span>open
62848- dialogs list</span>.</p></li>
62865+ <li><p>Set <span>is modal</span> of <var>subject</var> to true.</p></li>
6284962866
6285062867 <li>
6285162868 <p>Set <var>subject</var>'s <span>node document</span> to be <span data-x="blocked by a modal
@@ -62863,8 +62880,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6286362880 already <span data-x="list contains">contain</span> <var>subject</var>, then <span>add an element
6286462881 to the top layer</span> given <var>subject</var>.</p></li>
6286562882
62866- <li><p><span>Set the dialog close watcher</span> with <var>subject</var>.</p></li>
62867-
6286862883 <li><p>Set <var>subject</var>'s <span>previously focused element</span> to the
6286962884 <span>focused</span> element.</p></li>
6287062885
@@ -62891,6 +62906,13 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6289162906 element <var>dialog</var>:</p>
6289262907
6289362908 <ol>
62909+ <li><p><span>Assert</span>: <span>dialog</span>'s
62910+ <span data-x="dialog-close-watcher">close watcher</span> is not null.</p></li>
62911+
62912+ <li><p><span>Assert</span>: <var>dialog</var> has an <code data-x="attr-dialog-open">open</code>
62913+ attribute and <var>dialog</var>'s <span>node document</span> is <span>fully active</span>.</p>
62914+ </li>
62915+
6289462916 <li>
6289562917 <p>Set <var>dialog</var>'s <span data-x="dialog-close-watcher">close watcher</span> to the
6289662918 result of <span data-x="establish a close watcher">establishing a close watcher</span> given
@@ -63011,9 +63033,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6301163033
6301263034 <li><p>Set <span>is modal</span> of <var>subject</var> to false.</p></li>
6301363035
63014- <li><p><span data-x="list remove">Remove</span> <var>subject</var> from <var>subject</var>'s
63015- <span>node document</span>'s <span>open dialogs list</span>.</p></li>
63016-
6301763036 <li><p>If <var>result</var> is not null, then set <var>subject</var>'s <code
6301863037 data-x="dom-dialog-returnValue">returnValue</code> attribute to <var>result</var>.</p></li>
6301963038
@@ -63041,19 +63060,6 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6304163060 <li><p><span>Queue an element task</span> on the <span>user interaction task source</span> given the
6304263061 <var>subject</var> element to <span data-x="concept-event-fire">fire an event</span> named
6304363062 <code data-x="event-close">close</code> at <var>subject</var>.</p></li>
63044-
63045- <li>
63046- <p>If <var>subject</var>'s <span data-x="dialog-close-watcher">close watcher</span> is not null,
63047- then:</p>
63048-
63049- <ol>
63050- <li><p><span data-x="close-watcher-destroy">Destroy</span> <var>subject</var>'s <span
63051- data-x="dialog-close-watcher">close watcher</span>.</p></li>
63052-
63053- <li><p>Set <var>subject</var>'s <span data-x="dialog-close-watcher">close watcher</span> to
63054- null.</p></li>
63055- </ol>
63056- </li>
6305763063 </ol>
6305863064
6305963065 <p>To <dfn data-x="dialog-request-close">request to close</dfn> <code>dialog</code> element
@@ -63064,6 +63070,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6306463070 <li><p>If <var>subject</var> does not have an <code data-x="attr-dialog-open">open</code>
6306563071 attribute, then return.</p></li>
6306663072
63073+ <li><p>If <var>subject</var> is not <span>connected</span> or <var>subject</var>'s
63074+ <span>node document</span> is not <span>fully active</span>, then return.</p></li>.
63075+
6306763076 <li><p><span>Assert</span>: <var>subject</var>'s <span data-x="dialog-close-watcher">close
6306863077 watcher</span> is not null.</p></li>
6306963078
@@ -63189,6 +63198,45 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
6318963198 <li><p>Set <var>topDocument</var>'s <span>autofocus processed flag</span> to true.</p></li>
6319063199 </ol>
6319163200
63201+ <p>The <dfn>dialog setup steps</dfn>, given a <code>dialog</code> element <var>subject</var>, are
63202+ as follows:</p>
63203+
63204+ <ol>
63205+ <li><p><span>Assert</span>: <var>subject</var> has an <code data-x="attr-dialog-open">open</code>
63206+ attribute.</p></li>
63207+
63208+ <li><p><span>Assert</span>: <var>subject</var> is <span>connected</span>.</p></li>
63209+
63210+ <li><p><span>Assert</span>: <var>subject</var>'s <span>node document</span>'s <span>open dialogs
63211+ list</span> does not <span data-x="list contains">contain</span> <var>subject</var>.</p></li>
63212+
63213+ <li><p>Add <var>subject</var> to <var>subject</var>'s <span>node document</span>'s <span>open
63214+ dialogs list</span>.</p></li>
63215+
63216+ <li><p><span>Set the dialog close watcher</span> with <var>subject</var>.</p></li>
63217+ </ol>
63218+
63219+ <p>The <dfn>dialog cleanup steps</dfn>, given a <code>dialog</code> element <var>subject</var>,
63220+ are as follows:</p>
63221+
63222+ <ol>
63223+ <li><p><span data-x="list remove">Remove</span> <var>subject</var> from <var>subject</var>'s
63224+ <span>node document</span>'s <span>open dialogs list</span>.</p></li>
63225+
63226+ <li>
63227+ <p>If <var>subject</var>'s <span data-x="dialog-close-watcher">close watcher</span> is not
63228+ null, then:</p>
63229+
63230+ <ol>
63231+ <li><p><span data-x="close-watcher-destroy">Destroy</span> <var>subject</var>'s <span
63232+ data-x="dialog-close-watcher">close watcher</span>.</p></li>
63233+
63234+ <li><p>Set <var>subject</var>'s <span data-x="dialog-close-watcher">close watcher</span> to
63235+ null.</p></li>
63236+ </ol>
63237+ </li>
63238+ </ol>
63239+
6319263240 <h4><dfn>Dialog light dismiss</dfn></h4>
6319363241
6319463242 <p class="note">"Light dismiss" means that clicking outside of a <code>dialog</code> element whose <code
0 commit comments