Ensure required attributes are set
- Rule ID:
- element-required-attributes
- Category:
- Content model
- Standards:
- HTML5
Ensures required attributes are present but may be empty.
Use attribute-allowed-values
rule to disallow certain values.
The requirements comes from the element metadata:
{
"img": {
"attributes": {
"src": {
"required": true
}
}
}
}
Rule details
Examples of incorrect code for this rule:
<img>
Examples of correct code for this rule:
<img src="cat.gif">