relax a little

pull/8520/head
Simon Holthausen 3 years ago
parent c0b9cc1a33
commit 1ab4085c9f

@ -853,8 +853,8 @@ export default class Element extends Node {
const autocomplete = attribute_map.get('autocomplete'); const autocomplete = attribute_map.get('autocomplete');
if (type && autocomplete) { if (type && autocomplete) {
const type_value: null | true | string = type.get_static_value(); const type_value = type.get_static_value();
const autocomplete_value: null | true | string = autocomplete.get_static_value(); const autocomplete_value = autocomplete.get_static_value();
if (!is_valid_autocomplete(type_value, autocomplete_value)) { if (!is_valid_autocomplete(type_value, autocomplete_value)) {
component.warn(autocomplete, compiler_warnings.a11y_autocomplete_valid(type_value, autocomplete_value)); component.warn(autocomplete, compiler_warnings.a11y_autocomplete_valid(type_value, autocomplete_value));

@ -228,6 +228,9 @@ export function is_semantic_role_element(role: ARIARoleDefinitionKey, tag_name:
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofilling-form-controls:-the-autocomplete-attribute
const address_type_tokens = new Set(['shipping', 'billing']); const address_type_tokens = new Set(['shipping', 'billing']);
const autofill_field_name_tokens = new Set([ const autofill_field_name_tokens = new Set([
'',
'on',
'off',
'name', 'name',
'honorific-prefix', 'honorific-prefix',
'given-name', 'given-name',
@ -293,16 +296,6 @@ export function is_valid_autocomplete(type: null | true | string, autocomplete:
} }
const tokens = autocomplete.trim().toLowerCase().split(regex_whitespaces); const tokens = autocomplete.trim().toLowerCase().split(regex_whitespaces);
const normalized_type = type.toLowerCase();
const input_wears_autofill_anchor_mantle = normalized_type === 'hidden';
const input_wears_autofill_expectation_mantle = !input_wears_autofill_anchor_mantle;
if (input_wears_autofill_expectation_mantle) {
if (tokens[0] === 'on' || tokens[0] === 'off') {
return tokens.length === 1;
}
}
if (typeof tokens[0] === 'string' && tokens[0].startsWith('section-')) { if (typeof tokens[0] === 'string' && tokens[0].startsWith('section-')) {
tokens.shift(); tokens.shift();

@ -11,11 +11,11 @@
<input type="TEXT" autocomplete="ON" /> <input type="TEXT" autocomplete="ON" />
<input type="email" autocomplete="url" /> <input type="email" autocomplete="url" />
<input type="text" autocomplete="section-blue shipping street-address" /> <input type="text" autocomplete="section-blue shipping street-address" />
<!-- INVALID -->
<input type="text" autocomplete />
<input type="hidden" autocomplete="off" /> <input type="hidden" autocomplete="off" />
<input type="hidden" autocomplete="on" /> <input type="hidden" autocomplete="on" />
<input type="text" autocomplete="" /> <input type="text" autocomplete="" />
<!-- INVALID -->
<input type="text" autocomplete />
<input type="text" autocomplete="incorrect" /> <input type="text" autocomplete="incorrect" />
<input type="text" autocomplete="webauthn" /> <input type="text" autocomplete="webauthn" />

@ -3,45 +3,9 @@
"code": "a11y-autocomplete-valid", "code": "a11y-autocomplete-valid",
"end": { "end": {
"column": 31, "column": 31,
"line": 16
},
"message": "A11y: The value 'true' is not supported by the attribute 'autocomplete' on element <input type=\"text\">",
"start": {
"column": 19,
"line": 16
}
},
{
"code": "a11y-autocomplete-valid",
"end": {
"column": 39,
"line": 17
},
"message": "A11y: The value 'off' is not supported by the attribute 'autocomplete' on element <input type=\"hidden\">",
"start": {
"column": 21,
"line": 17
}
},
{
"code": "a11y-autocomplete-valid",
"message": "A11y: The value 'on' is not supported by the attribute 'autocomplete' on element <input type=\"hidden\">",
"end": {
"column": 38,
"line": 18
},
"start": {
"column": 21,
"line": 18
}
},
{
"code": "a11y-autocomplete-valid",
"message": "A11y: The value '' is not supported by the attribute 'autocomplete' on element <input type=\"text\">",
"end": {
"column": 34,
"line": 19 "line": 19
}, },
"message": "A11y: The value 'true' is not supported by the attribute 'autocomplete' on element <input type=\"text\">",
"start": { "start": {
"column": 19, "column": 19,
"line": 19 "line": 19

Loading…
Cancel
Save