|
|
|
@ -261,8 +261,7 @@ export default class Element extends Node {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.name === 'textarea') {
|
|
|
|
if (this.name === 'textarea' && info.children.length) {
|
|
|
|
if (info.children.length > 0) {
|
|
|
|
|
|
|
|
const value_attribute = info.attributes.find(node => node.name === 'value');
|
|
|
|
const value_attribute = info.attributes.find(node => node.name === 'value');
|
|
|
|
if (value_attribute) {
|
|
|
|
if (value_attribute) {
|
|
|
|
component.error(value_attribute, compiler_errors.textarea_duplicate_value);
|
|
|
|
component.error(value_attribute, compiler_errors.textarea_duplicate_value);
|
|
|
|
@ -279,7 +278,6 @@ export default class Element extends Node {
|
|
|
|
|
|
|
|
|
|
|
|
info.children = [];
|
|
|
|
info.children = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.name === 'option') {
|
|
|
|
if (this.name === 'option') {
|
|
|
|
// Special case — treat these the same way:
|
|
|
|
// Special case — treat these the same way:
|
|
|
|
@ -688,20 +686,10 @@ export default class Element extends Node {
|
|
|
|
|
|
|
|
|
|
|
|
if (this.name === 'label') {
|
|
|
|
if (this.name === 'label') {
|
|
|
|
const has_input_child = (children: INode[]) => {
|
|
|
|
const has_input_child = (children: INode[]) => {
|
|
|
|
if (children.some(child => (child instanceof Element && (a11y_labelable.has(child.name) || child.name === 'slot')))) {
|
|
|
|
return children.some(child => (child instanceof Element && (a11y_labelable.has(child.name) || child.name === 'slot'))) ||
|
|
|
|
return true;
|
|
|
|
children.some(child =>
|
|
|
|
}
|
|
|
|
('children' in child) && child.children.length && has_input_child(child.children)
|
|
|
|
|
|
|
|
);
|
|
|
|
for (const child of children) {
|
|
|
|
|
|
|
|
if (!('children' in child) || child.children.length === 0) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (has_input_child(child.children)) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (!attribute_map.has('for') && !has_input_child(this.children)) {
|
|
|
|
if (!attribute_map.has('for') && !has_input_child(this.children)) {
|
|
|
|
@ -714,11 +702,9 @@ export default class Element extends Node {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let has_caption;
|
|
|
|
const has_caption = this.children
|
|
|
|
const track = this.children.find((i: Element) => i.name === 'track');
|
|
|
|
.find((i: Element) => i.name === 'track')
|
|
|
|
if (track) {
|
|
|
|
?.attributes.find(a => a.name === 'kind' && a.get_static_value() === 'captions');
|
|
|
|
has_caption = track.attributes.find(a => a.name === 'kind' && a.get_static_value() === 'captions');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!has_caption) {
|
|
|
|
if (!has_caption) {
|
|
|
|
component.warn(this, compiler_warnings.a11y_media_has_caption);
|
|
|
|
component.warn(this, compiler_warnings.a11y_media_has_caption);
|
|
|
|
@ -1011,7 +997,7 @@ export default class Element extends Node {
|
|
|
|
const attribute = this.attributes.find(a => a.name === attribute_name);
|
|
|
|
const attribute = this.attributes.find(a => a.name === attribute_name);
|
|
|
|
if (attribute && !attribute.is_true) {
|
|
|
|
if (attribute && !attribute.is_true) {
|
|
|
|
attribute.chunks.forEach((chunk, index) => {
|
|
|
|
attribute.chunks.forEach((chunk, index) => {
|
|
|
|
if (chunk.type === 'Text') {
|
|
|
|
if (chunk.type !== 'Text') return;
|
|
|
|
let data = chunk.data.replace(regex_any_repeated_whitespaces, ' ');
|
|
|
|
let data = chunk.data.replace(regex_any_repeated_whitespaces, ' ');
|
|
|
|
if (index === 0) {
|
|
|
|
if (index === 0) {
|
|
|
|
data = data.trimLeft();
|
|
|
|
data = data.trimLeft();
|
|
|
|
@ -1019,7 +1005,6 @@ export default class Element extends Node {
|
|
|
|
data = data.trimRight();
|
|
|
|
data = data.trimRight();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chunk.data = data;
|
|
|
|
chunk.data = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|