Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Editorial] rework button states to allow for command/commandfor attributes #10960

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 48 additions & 27 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -53480,16 +53480,16 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
<tr>
<td><dfn attr-value for="button/type"><code
data-x="attr-button-type-submit">submit</code></dfn>
<td><span data-x="attr-button-type-submit-state">Submit Button</span>
<td><dfn data-x="attr-button-type-submit-state">Submit Button</dfn>
<td>Submits the form.
<tr>
<td><dfn attr-value for="button/type"><code data-x="attr-button-type-reset">reset</code></dfn>
<td><span data-x="attr-button-type-reset-state">Reset Button</span>
<td><dfn data-x="attr-button-type-reset-state">Reset Button</dfn>
<td>Resets the form.
<tr>
<td><dfn attr-value for="button/type"><code
data-x="attr-button-type-button">button</code></dfn>
<td><span data-x="attr-button-type-button-state">Button</span>
<td><dfn data-x="attr-button-type-button-state">Button</dfn>
<td>Does nothing.
</table>

Expand All @@ -53498,15 +53498,18 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
data-x="attr-button-type-submit-state">Submit Button</span> state.</p>

<p>If the <code data-x="attr-button-type">type</code> attribute is in the <span
data-x="attr-button-type-submit-state">Submit Button</span> state, the element is specifically a
<span data-x="concept-submit-button">submit button</span>.</p>
data-x="attr-button-type-submit-state">Submit Button</span> state, the element is
keithamus marked this conversation as resolved.
Show resolved Hide resolved
specifically a <span data-x="concept-submit-button">submit button</span>.</p>

keithamus marked this conversation as resolved.
Show resolved Hide resolved
<p>If the <code data-x="attr-button-type">type</code> content attribute is present, and in the
<span data-x="attr-button-type-submit-state">Submit Button</span> state, the element is
keithamus marked this conversation as resolved.
Show resolved Hide resolved
specifically a <span data-x="concept-submit-button">submit button</span>.</p>

<div w-nodev>

<p><strong>Constraint validation</strong>: If the <code data-x="attr-button-type">type</code>
attribute is in the <span data-x="attr-button-type-reset-state">Reset Button</span> state or the
<span data-x="attr-button-type-button-state">Button</span> state, the element is <span>barred from
constraint validation</span>.</p>
<p><strong>Constraint validation</strong>: If the element is not a <span
data-x="concept-submit-button">submit button</span>, the element is <span>barred from constraint
validation</span>.</p>

<p>A <code>button</code> element <var>element</var>'s <span>activation behavior</span> given
<var>event</var> is:</p>
Expand All @@ -53519,23 +53522,29 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
return.</p></li>

<li>
<p>If <var>element</var> has a <span>form owner</span> then switch on <var>element</var>'s <code
data-x="attr-button-type">type</code> attribute's state, then:</p>
<p>If <var>element</var> is a <span data-x="concept-submit-button">submit button</span>:</p>
<ol>

<dl>
<dt> <dfn data-x="attr-button-type-submit-state">Submit Button</dfn> </dt>
<dd><p><span data-x="concept-form-submit">Submit</span> <var>element</var>'s <span>form
<li><p>If <var>element</var> has a <span>form owner</span> then <span
data-x="concept-form-submit">Submit</span> <var>element</var>'s <span>form
owner</span> from <var>element</var> with <i
data-x="submit-user-involvement">userInvolvement</i> set to <var>event</var>'s <span
data-x="event-uni">user navigation involvement</span>.</p></dd>
data-x="event-uni">user navigation involvement</span>.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<dt> <dfn data-x="attr-button-type-reset-state">Reset Button</dfn> </dt>
<dd><p><span data-x="concept-form-reset">Reset</span> <var>element</var>'s <span>form
owner</span>.</p></dd>
<li>
<p>If <var>element</var>'s <code data-x="attr-button-type">type</code> attribute is in the <span
data-x="attr-button-type-reset-state">Reset Button</span> state:</p>

<dt> <dfn data-x="attr-button-type-button-state">Button</dfn>
<dd><p>Do nothing.</p></dd>
</dl>
<ol>
<li><p>If <var>element</var> has a <span>form owner</span> then <span
data-x="concept-form-reset">Reset</span> <var>element</var>'s <span>form owner</span>.</p></li>
keithamus marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Return.</p></li>
</ol>
</li>

<li><p>Run the <span>popover target attribute activation behavior</span> given <var>element</var>
Expand All @@ -53562,9 +53571,8 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
data-x="attr-fs-formenctype">formenctype</code>, <code
data-x="attr-fs-formmethod">formmethod</code>, <code
data-x="attr-fs-formnovalidate">formnovalidate</code>, and <code
data-x="attr-fs-formtarget">formtarget</code> must not be specified if the element's <code
data-x="attr-button-type">type</code> attribute is not in the <span
data-x="attr-button-type-submit-state">Submit Button</span> state.</p>
data-x="attr-fs-formtarget">formtarget</code> must not be specified if the element is not a <code
data-x="concept-submit-button">submit button</code>.</p>

<p>The <dfn element-attr for="button"><code data-x="attr-button-value">value</code></dfn>
attribute gives the element's value for the purposes of form submission. The element's <span
Expand All @@ -53582,9 +53590,22 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
<p>The <dfn attribute for="HTMLButtonElement"><code data-x="dom-button-value">value</code></dfn>
IDL attribute must <span>reflect</span> the content attribute of the same name.</p>

<p>The <dfn attribute for="HTMLButtonElement"><code data-x="dom-button-type">type</code></dfn> IDL
attribute must <span>reflect</span> the content attribute of the same name, <span>limited to only
known values</span>.</p>
<p>The <dfn attribute for="HTMLButtonElement"><code data-x="dom-button-type">type</code></dfn>
getter steps are:</p>

<ol>
<li><p>If <span>this</span> is a <span data-x="concept-submit-button">submit button</span>, then
return "<code data-x="">submit</code>".</p></li>

<li><p>If <span>this</span>'s <span data-x="attr-button-type">type</span> attribute is in the
<span data-x="attr-button-type-reset-state">Reset</span> state, then return "<code
keithamus marked this conversation as resolved.
Show resolved Hide resolved
data-x="">reset</code>".</p></li>

<li><p>Return "<code data-x="">button</code>".</p></li>
</ol>

<p>The <code data-x="dom-button-type">type</code> setter steps are to set the <code
data-x="attr-button-type">type</code> content attribute to the given value.</p>

<p>The <code data-x="dom-cva-willValidate">willValidate</code>, <code
data-x="dom-cva-validity">validity</code>, and <code
Expand Down