Skip to content

Commit

Permalink
[e] (0) Rearrange how 'autocomplete' is defined to make it possible t…
Browse files Browse the repository at this point in the history
…o apply it to other controls

Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7208 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 26, 2012
1 parent 65d1859 commit 94e521f
Show file tree
Hide file tree
Showing 3 changed files with 336 additions and 323 deletions.
205 changes: 104 additions & 101 deletions complete.html
Expand Up @@ -738,7 +738,8 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 26 July 2012</h2>
<li><a href=#limiting-user-input-length:-the-maxlength-attribute><span class=secno>4.10.19.4 </span>Limiting user input length: the <code title=attr-fe-maxlength>maxlength</code> attribute</a></li>
<li><a href=#form-submission-0><span class=secno>4.10.19.5 </span>Form submission</a></li>
<li><a href=#submitting-element-directionality:-the-dirname-attribute><span class=secno>4.10.19.6 </span>Submitting element directionality: the <code title="form control dirname attribute">dirname</code> attribute</a></li>
<li><a href=#input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.7 </span>Input modalities: the <code title=attr-inputmode>inputmode</code> attribute</a></ol></li>
<li><a href=#autofilling-form-controls:-the-autocomplete-attribute><span class=secno>4.10.19.7 </span>Autofilling form controls: the <code title=attr-fe-autocomplete>autocomplete</code> attribute</a></li>
<li><a href=#input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.8 </span>Input modalities: the <code title=attr-inputmode>inputmode</code> attribute</a></ol></li>
<li><a href=#textFieldSelection><span class=secno>4.10.20 </span>APIs for the text field selections</a></li>
<li><a href=#constraints><span class=secno>4.10.21 </span>Constraints</a>
<ol>
Expand Down Expand Up @@ -45189,15 +45190,16 @@ <h4 id=categories><span class=secno>4.10.2 </span>Categories</h4>
<p>The <dfn id=attr-form-autocomplete title=attr-form-autocomplete><code>autocomplete</code></dfn>
attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The attribute has
two states. The <code title=attr-form-autocomplete-on>on</code>
keyword maps to the <dfn id=attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</dfn> state, and the
keyword maps to the <dfn id=attr-form-autocomplete-automatic-state title=attr-form-autocomplete-automatic-state>on</dfn> state, and the
<code title=attr-form-autocomplete-off>off</code> keyword maps to
the <dfn id=attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</dfn>
state. The attribute may also be omitted. The <i>missing value
default</i> is the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state. The <a href=#attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</a> state indicates
that by default, <code><a href=#the-input-element>input</a></code> elements in the form will have
their <a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">off</i>; the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state indicates
that by default, <code><a href=#the-input-element>input</a></code> elements in the form will have
their <a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">on</i>.</p>
the <dfn id=attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</dfn> state.
The attribute may also be omitted. The <i>missing value default</i>
is the <a href=#attr-form-autocomplete-automatic-state title=attr-form-autocomplete-automatic-state>on</a>
state. The <a href=#attr-form-autocomplete-off-state title=attr-form-autocomplete-off-state>off</a>
state indicates that by default, form controls in the form will have
their <a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">off</i>; the <a href=#attr-form-autocomplete-automatic-state title=attr-form-autocomplete-automatic-state>on</a> state indicates
that by default, form controls in the form will have their
<a href=#resulting-autocompletion-state>resulting autocompletion state</a> set to <i title="">automatic</i>.</p>

<p>The <code title=attr-fs-action><a href=#attr-fs-action>action</a></code>, <code title=attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>, <code title=attr-fs-method><a href=#attr-fs-method>method</a></code>, <code title=attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>, and <code title=attr-fs-target><a href=#attr-fs-target>target</a></code> attributes are <a href=#attributes-for-form-submission>attributes
for form submission</a>.</p>
Expand Down Expand Up @@ -50629,84 +50631,8 @@ <h5 id=common-input-element-attributes><span class=secno>4.10.7.3 </span>Common

<h6 id=the-autocomplete-attribute><span class=secno>4.10.7.3.1 </span>The <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code> attribute</h6>

<p>User agents sometimes have features for helping users fill forms
in, for example prefilling the user's address based on earlier user
input.</p>

<p>The <dfn id=attr-input-autocomplete title=attr-input-autocomplete><code>autocomplete</code></dfn>
attribute is an <a href=#enumerated-attribute>enumerated attribute</a>. The attribute has
three states. The <code title=attr-input-autocomplete-on>on</code>
keyword maps to the <dfn id=attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</dfn> state, and the
<code title=attr-input-autocomplete-off>off</code> keyword maps to
the <dfn id=attr-input-autocomplete-off-state title=attr-input-autocomplete-off-state>off</dfn>
state. The attribute may also be omitted. The <i>missing value
default</i> is the <dfn id=attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</dfn>
state.</p>

<p>The <a href=#attr-input-autocomplete-off-state title=attr-input-autocomplete-off-state>off</a>
state indicates either that the control's input data is particularly
sensitive (for example the activation code for a nuclear weapon); or
that it is a value that will never be reused (for example a
one-time-key for a bank login) and the user will therefore have to
explicitly enter the data each time, instead of being able to rely
on the UA to prefill the value for him; or that the document
provides its own autocomplete mechanism and does not want the user
agent to provide autocompletion values.</p>

<p>Conversely, the <a href=#attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</a> state indicates
that the value is not particularly sensitive and the user can expect
to be able to rely on his user agent to remember values he has
entered for that control.</p>

<p>The <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state
indicates that the user agent is to use the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute on the
element's <a href=#form-owner>form owner</a> instead. (By default, the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute of
<code><a href=#the-form-element>form</a></code> elements is in the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a> state.)</p>

<div class=impl>

<p>Each <code><a href=#the-input-element>input</a></code> element has a <dfn id=resulting-autocompletion-state>resulting
autocompletion state</dfn>, which is either <i title="">on</i> or <i title="">off</i>.</p>

<p>When an <code><a href=#the-input-element>input</a></code> element is in one of the following
conditions, the <code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> is <i title="">on</i>; otherwise, the
<code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting autocompletion
state</a> is <i title="">off</i>:</p>

<ul class=brief><li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-input-autocomplete-on-state title=attr-input-autocomplete-on-state>on</a> state.</li>

<li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state,
and the element has no <a href=#form-owner>form owner</a>.</li>

<li>Its <code title=attr-input-autocomplete><a href=#attr-input-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-input-autocomplete-default-state title=attr-input-autocomplete-default-state>default</a> state,
and the element's <a href=#form-owner>form owner</a>'s <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is in
the <a href=#attr-form-autocomplete-on-state title=attr-form-autocomplete-on-state>on</a>
state.</li>

</ul><p>When an <code><a href=#the-input-element>input</a></code> element's <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> is <i title="">on</i>, the user agent
may store the value entered by the user so that if the user returns
to the page, the UA can prefill the form. Otherwise, the user agent
should not remember the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, and should not offer past
values to the user.</p>

<p>In addition, if the <a href=#resulting-autocompletion-state>resulting autocompletion state</a>
is <i title="">off</i>, <a href=#history-autocomplete>values are
reset</a> when <a href=#traverse-the-history title="traverse the history">traversing the
history</a>.</p>

<p>The autocompletion mechanism must be implemented by the user
agent acting as if the user had modified the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, and must be done at a time
where the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>
(e.g. just after the element has been inserted into the document, or
when the user agent <a href=#stop-parsing title="stop parsing">stops
parsing</a>).</p>

</div>
attribute, when it applies, is a <a href=#attr-fe-autocomplete title=attr-fe-autocomplete>form control <code title="">autocomplete</code> attribute</a>.</p>

<div class=example>

Expand All @@ -50718,18 +50644,6 @@ <h6 id=the-autocomplete-attribute><span class=secno>4.10.7.3.1 </span>The <code

</div>

<div class=impl>

<p>A user agent may allow the user to override the <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> and set it to always <i title="">on</i>,
always allowing values to be remembered and prefilled, or always <i title="">off</i>, never remembering values. However, user agents
should not allow users to trivially override the <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> to <i title="">on</i>, as there are
significant security implications for the user if all values are
always remembered, regardless of the site's preferences.</p>

</div>


<h6 id=the-dirname-attribute><span class=secno>4.10.7.3.2 </span>The <code title=attr-input-dirname><a href=#attr-input-dirname>dirname</a></code> attribute</h6>

Expand Down Expand Up @@ -54769,8 +54683,97 @@ <h5 id=submitting-element-directionality:-the-dirname-attribute><span class=secn
string.</p>


<h5 id=autofilling-form-controls:-the-autocomplete-attribute><span class=secno>4.10.19.7 </span>Autofilling form controls: the <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute</h5>

<p>User agents sometimes have features for helping users fill forms
in, for example prefilling the user's address based on earlier user
input.</p>

<p>A <dfn id=attr-fe-autocomplete title=attr-fe-autocomplete>form control <code title="">autocomplete</code> attribute</dfn> on a form control is an
<a href=#enumerated-attribute>enumerated attribute</a>. The attribute has three states.
The <code title=attr-fe-autocomplete-on>on</code> keyword maps to
the <dfn id=attr-fe-autocomplete-automatic-state title=attr-fe-autocomplete-automatic-state>automatic</dfn> state,
and the <code title=attr-fe-autocomplete-off>off</code> keyword
maps to the <dfn id=attr-fe-autocomplete-off-state title=attr-fe-autocomplete-off-state>off</dfn>
state. The attribute may also be omitted. The <i>missing value
default</i> is the <dfn id=attr-fe-autocomplete-default-state title=attr-fe-autocomplete-default-state>default</dfn> state.</p>

<p>The <a href=#attr-fe-autocomplete-off-state title=attr-fe-autocomplete-off-state>off</a>
state indicates either that the control's input data is particularly
sensitive (for example the activation code for a nuclear weapon); or
that it is a value that will never be reused (for example a
one-time-key for a bank login) and the user will therefore have to
explicitly enter the data each time, instead of being able to rely
on the UA to prefill the value for him; or that the document
provides its own autocomplete mechanism and does not want the user
agent to provide autocompletion values.</p>

<p>Conversely, the <a href=#attr-fe-autocomplete-automatic-state title=attr-fe-autocomplete-automatic-state>automatic</a> state
indicates that the value is not particularly sensitive and the user
can expect to be able to rely on his user agent to remember values
he has entered for that control.</p>

<p>The <a href=#attr-fe-autocomplete-default-state title=attr-fe-autocomplete-default-state>default</a> state
indicates that the user agent is to use the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute on the
element's <a href=#form-owner>form owner</a> instead. (By default, the <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute of
<code><a href=#the-form-element>form</a></code> elements is in the <a href=#attr-form-autocomplete-automatic-state title=attr-form-autocomplete-automatic-state>on</a> state.)</p>

<div class=impl>

<p>Each form control defined to have a <a href=#attr-fe-autocomplete title=attr-fe-autocomplete>form control <code title="">autocomplete</code> attribute</a> has a <dfn id=resulting-autocompletion-state>resulting
autocompletion state</dfn>, which is either <i title="">automatic</i> or <i title="">off</i>.</p>

<p>When such a form control is in one of the following conditions,
its <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">automatic</i>; otherwise, the its <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> is <i title="">off</i>:</p>

<ul class=brief><li>Its <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-fe-autocomplete-automatic-state title=attr-fe-autocomplete-automatic-state>automatic</a>
state.</li>

<li>Its <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-fe-autocomplete-default-state title=attr-fe-autocomplete-default-state>default</a> state,
and the element has no <a href=#form-owner>form owner</a>.</li>

<li>Its <code title=attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
attribute is in the <a href=#attr-fe-autocomplete-default-state title=attr-fe-autocomplete-default-state>default</a> state,
and the element's <a href=#form-owner>form owner</a>'s <code title=attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is in
the <a href=#attr-form-autocomplete-automatic-state title=attr-form-autocomplete-automatic-state>automatic</a>
state.</li>

</ul><p>When a form control's <a href=#resulting-autocompletion-state>resulting autocompletion state</a>
is <i title="">automatic</i>, the user agent may store the value
entered or selected by the user so that if the user returns to the
page, the UA can prefill the form. Otherwise, the user agent should
not remember the control's <a href=#concept-fe-value title=concept-fe-value>value</a>, and should not offer past
values to the user.</p>

<p>In addition, if the <a href=#resulting-autocompletion-state>resulting autocompletion state</a>
is <i title="">off</i>, <a href=#history-autocomplete>values are
reset</a> when <a href=#traverse-the-history title="traverse the history">traversing the
history</a>.</p>

<p>The autocompletion mechanism must be implemented by the user
agent acting as if the user had modified the element's <a href=#concept-fe-value title=concept-fe-value>value</a>, and must be done at a time
where the element is <i title=concept-input-mutable><a href=#concept-input-mutable>mutable</a></i>
(e.g. just after the element has been inserted into the document, or
when the user agent <a href=#stop-parsing title="stop parsing">stops
parsing</a>).</p> <!-- XXX only input elements have
concept-input-mutable -->

<p>A user agent may allow the user to override the <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> and set it to always <i title="">on</i>,
always allowing values to be remembered and prefilled, or always <i title="">off</i>, never remembering values. However, user agents
should not allow users to trivially override the <a href=#resulting-autocompletion-state>resulting
autocompletion state</a> to <i title="">on</i>, as there are
significant security implications for the user if all values are
always remembered, regardless of the site's preferences.</p>

</div>



<h5 id=input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.7 </span>Input modalities: the <code title=attr-inputmode><a href=#attr-inputmode>inputmode</a></code> attribute</h5>
<h5 id=input-modalities:-the-inputmode-attribute><span class=secno>4.10.19.8 </span>Input modalities: the <code title=attr-inputmode><a href=#attr-inputmode>inputmode</a></code> attribute</h5>

<!-- v2: Apply this to contentEditable elements -->

Expand Down Expand Up @@ -69705,8 +69708,8 @@ <h4 id=history-traversal><span class=secno>6.6.10 </span>History traversal</h4>
</ol></li>

<li id=history-autocomplete><p>If the <var title="">specified
entry</var>'s <code><a href=#document>Document</a></code> has any <code><a href=#the-input-element>input</a></code>
elements whose <a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
entry</var>'s <code><a href=#document>Document</a></code> has any form controls whose
<a href=#resulting-autocompletion-state>resulting autocompletion state</a> is <i title="">off</i>, invoke the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a> of each
of those elements.</li>

<li><p>If the <a href=#current-document-readiness>current document readiness</a> of the <var title="">specified entry</var>'s <code><a href=#document>Document</a></code> is
Expand Down

0 comments on commit 94e521f

Please sign in to comment.