fix: instead of deleting, add a new attribute to class

instead of deleting the <a> element from the Set, add a new attribute to to indicate it doesnt need a child
pull/8299/head
vibovenkat123 4 years ago
parent d001536efd
commit f3807df59e

@ -225,6 +225,7 @@ export default class Element extends Node {
namespace: string; namespace: string;
needs_manual_style_scoping: boolean; needs_manual_style_scoping: boolean;
tag_expr: Expression; tag_expr: Expression;
contains_a11y_label: boolean;
get is_dynamic_element() { get is_dynamic_element() {
return this.name === 'svelte:element'; return this.name === 'svelte:element';
@ -644,7 +645,7 @@ export default class Element extends Node {
if (aria_label_attribute) { if (aria_label_attribute) {
const aria_value = aria_label_attribute.get_static_value(); const aria_value = aria_label_attribute.get_static_value();
if (aria_value != '') { if (aria_value != '') {
a11y_required_content.delete('a'); this.contains_a11y_label = true;
} }
} }
if (href_attribute) { if (href_attribute) {
@ -927,6 +928,7 @@ export default class Element extends Node {
validate_content() { validate_content() {
if (!a11y_required_content.has(this.name)) return; if (!a11y_required_content.has(this.name)) return;
if (this.contains_a11y_label) return;
if ( if (
this.bindings this.bindings
.some((binding) => ['textContent', 'innerHTML'].includes(binding.name)) .some((binding) => ['textContent', 'innerHTML'].includes(binding.name))

Loading…
Cancel
Save