Skip to content

Commit 08fc241

Browse files
committed
Element Clear: Apply to all resettable elements
There's no reason to discriminate. We rely on the fact that the focusing and unfocusing steps are run in order to ensure that the correct "onchange" event is fired. Existing implementations based on Selenium's "atoms" don't bother firing an `input` event, and so neither do we. As specced, this is a slow-motion way of calling a form's `reset` method with additional focusing steps. It fulfills the need of users to reset form fields to their default values. Closes #561
1 parent 2da9ac4 commit 08fc241

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

webdriver-spec.html

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ <h3>Dependencies</h3>
314314
<!-- Replacement enabled --> <li><dfn><a href=https://html.spec.whatwg.org/#replacement-enabled>Replacement enabled</a></dfn>
315315
<!-- Reset algorithm --><li><dfn><a href=https://html.spec.whatwg.org/#concept-form-reset-control>Reset algorithm</a></dfn>
316316
<!-- Reset Button --> <li><dfn><a href="https://html.spec.whatwg.org/#reset-button-state-%28type=reset%29">Reset Button</a></dfn> state
317+
<!-- Resettable element --> <li><dfn><a href=https://html.spec.whatwg.org/#category-reset>Resettable</a></dfn> element
317318
<!-- Script execution environment --> <li><dfn><a href=https://html.spec.whatwg.org/#environment>Script execution environment</a></dfn>
318319
<!-- Script --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-script>Script</a></dfn>
319320
<!-- Selectedness --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-option-selectedness>Selectedness</a></dfn>
@@ -5297,9 +5298,8 @@ <h3>Element Clear</h3>
52975298
</table>
52985299

52995300
<p>The <dfn>Element Clear</dfn> <a>command</a>
5300-
<a>scrolls into view</a> an <a>editable</a> <a>element</a>, or
5301-
an <a><code>input</code> element</a> whose <a><code>type</code>
5302-
attribute</a> is <a>File</a> and then attempts to clear
5301+
<a>scrolls into view</a> an <a>editable</a>
5302+
or <a>resettable</a> <a>element</a> and then attempts to clear
53035303
its <a>selected files</a> or <a>text content</a>.
53045304

53055305
<p>The <a>remote end steps</a> are:
@@ -5312,8 +5312,9 @@ <h3>Element Clear</h3>
53125312
of <a>trying</a> to <a>get a known element</a>
53135313
with argument <var>element id</var>.
53145314

5315-
<li><p>If <var>element</var> is not <a>editable</a> return
5316-
an <a>error</a> with <a>error code</a> <a>invalid element state</a>.
5315+
<li><p>If <var>element</var> is not <a>editable</a> and is
5316+
not <a>resettable</a> return an <a>error</a> with <a>error
5317+
code</a> <a>invalid element state</a>.
53175318

53185319
<li><p><a>Scroll into view</a> the <var>element</var>.
53195320

@@ -5330,7 +5331,7 @@ <h3>Element Clear</h3>
53305331

53315332
<li>If <var>element</var> is <a>content editable</a> follow the steps
53325333
required to <a>clear a content editable element</a>. Otherwise,
5333-
follow the steps required to <a>clear an editable element</a>.
5334+
follow the steps required to <a>clear a resettable element</a>.
53345335

53355336
<li><p>Return <a>success</a> with data <a><code>null</code></a>.
53365337
</ol>
@@ -5347,12 +5348,10 @@ <h3>Element Clear</h3>
53475348
<li><p>Set <var>element</var>'s <a><code>innerHTML</code> IDL
53485349
attribute</a> to an empty string.
53495350

5350-
<li><p><a>Fire</a> an <a><code>input</code> event</a>.
5351-
53525351
<li><p>Run the <a>unfocusing steps</a> for the <var>element</var>.
53535352
</ol> <!-- /clearing a content editable element -->
53545353

5355-
<p>When required to <dfn>clear an editable element</dfn> a <a>remote
5354+
<p>When required to <dfn>clear a resettable element</dfn> a <a>remote
53565355
end</a> must run the following steps:
53575356

53585357
<ol>
@@ -5363,8 +5362,6 @@ <h3>Element Clear</h3>
53635362

53645363
<li><p>Run <var>element</var>'s <a>reset algorithm</a>.
53655364

5366-
<li><p><a>Fire</a> an <a><code>input</code> event</a>.
5367-
53685365
<li><p>Run the <a>unfocusing steps</a> for the <var>element</var>.
53695366
</ol> <!-- /clearing an editable element -->
53705367

0 commit comments

Comments
 (0)