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');
if (type && autocomplete) {
const type_value: null | true | string = type.get_static_value();
const autocomplete_value: null | true | string = autocomplete.get_static_value();
const type_value = type.get_static_value();
const autocomplete_value = autocomplete.get_static_value();
if (!is_valid_autocomplete(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
const address_type_tokens = new Set(['shipping', 'billing']);
const autofill_field_name_tokens = new Set([
'',
'on',
'off',
'name',
'honorific-prefix',
'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 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-')) {
tokens.shift();

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

@ -3,45 +3,9 @@
"code": "a11y-autocomplete-valid",
"end": {
"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
},
"message": "A11y: The value 'true' is not supported by the attribute 'autocomplete' on element <input type=\"text\">",
"start": {
"column": 19,
"line": 19

Loading…
Cancel
Save