simplify conditional logic

pull/7067/head
James Bradbury 5 years ago
parent b6060f3520
commit bb975e7b0c

@ -370,23 +370,17 @@ export default class Element extends Node {
} }
// no-redundant-roles // no-redundant-roles
if (this.name === value) { if (this.name === value ||
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); this.name === 'nav' && value === 'navigation' ||
} else if (this.name === 'nav' && value === 'navigation') { this.name === 'a' && value === 'link' ||
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); this.name === 'fieldset' && value === 'group' ||
} else if (this.name === 'a' && value === 'link') { this.name === 'ul' && value === 'list') {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
} else if (this.name === 'fieldset' && value === 'group') { }
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
} else if (this.name === 'ul' && value === 'list') {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
}
const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']); const is_parent_section_or_article = is_parent(this.parent, ['section', 'article']);
if (!is_parent_section_or_article) { if (!is_parent_section_or_article) {
if (this.name === 'header' && value === 'banner') { if (this.name === 'header' && value === 'banner' || this.name === 'footer' && value === 'contentinfo') {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
} else if (this.name === 'footer' && value === 'contentinfo') {
component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value)); component.warn(attribute, compiler_warnings.a11y_no_redundant_roles(value));
} }
} }

Loading…
Cancel
Save