diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 3fcec9784b..00c195a85c 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -102,7 +102,20 @@ export default function validateElement( ); } - checkTypeAttribute(validator, node); + if (node.name === 'select') { + const attribute = node.attributes.find( + (attribute: Node) => attribute.name === 'multiple' + ); + + if (attribute && isDynamic(attribute)) { + validator.error( + `'multiple' attribute cannot be dynamic if select uses two-way binding`, + attribute + ); + } + } else { + checkTypeAttribute(validator, node); + } } else if (name === 'checked' || name === 'indeterminate') { if (node.name !== 'input') { validator.error( diff --git a/test/validator/samples/binding-select-multiple-dynamic/errors.json b/test/validator/samples/binding-select-multiple-dynamic/errors.json new file mode 100644 index 0000000000..f6c9f145af --- /dev/null +++ b/test/validator/samples/binding-select-multiple-dynamic/errors.json @@ -0,0 +1,12 @@ +[{ + "message": "'multiple' attribute cannot be dynamic if select uses two-way binding", + "loc": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 28 + }, + "pos": 19 +}] \ No newline at end of file diff --git a/test/validator/samples/binding-select-multiple-dynamic/input.html b/test/validator/samples/binding-select-multiple-dynamic/input.html new file mode 100644 index 0000000000..17e928c562 --- /dev/null +++ b/test/validator/samples/binding-select-multiple-dynamic/input.html @@ -0,0 +1,5 @@ + \ No newline at end of file