prevent textarea from having both value and children

pull/599/head
Rich Harris 7 years ago
parent 5ccc200222
commit b2ea03dde0

@ -77,6 +77,14 @@ export default function validateElement ( validator: Validator, node: Node ) {
validator.error( `Missing transition '${attribute.name}'`, attribute.start );
}
}
else if ( attribute.type === 'Attribute' ) {
if ( attribute.name === 'value' && node.name === 'textarea' ) {
if ( node.children.length ) {
validator.error( `A <textarea> can have either a value attribute or (equivalently) child content, but not both`, attribute.start );
}
}
}
});
}

@ -0,0 +1,8 @@
[{
"message": "A <textarea> can have either a value attribute or (equivalently) child content, but not both",
"loc": {
"line": 1,
"column": 10
},
"pos": 10
}]

@ -0,0 +1,3 @@
<textarea value='{{foo}}'>
some illegal text
</textarea>
Loading…
Cancel
Save