diff --git a/src/validate/html/validateElement.ts b/src/validate/html/validateElement.ts index 2572fd29d4..16e5e05220 100644 --- a/src/validate/html/validateElement.ts +++ b/src/validate/html/validateElement.ts @@ -79,6 +79,17 @@ export default function validateElement( }); } + if (node.name === 'svg') { + node.attributes.forEach(attribute => { + if (attribute.name === 'viewbox') { + validator.warn( + ` has an invalid viewbox attribute – did you mean viewBox?`, + node.start + ) + } + }) + } + let hasIntro: boolean; let hasOutro: boolean; let hasTransition: boolean; diff --git a/test/validator/samples/svg-viewbox/input.html b/test/validator/samples/svg-viewbox/input.html new file mode 100644 index 0000000000..84ab3c11bd --- /dev/null +++ b/test/validator/samples/svg-viewbox/input.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/validator/samples/svg-viewbox/warnings.json b/test/validator/samples/svg-viewbox/warnings.json new file mode 100644 index 0000000000..4cb413b730 --- /dev/null +++ b/test/validator/samples/svg-viewbox/warnings.json @@ -0,0 +1,8 @@ +[{ + "message": " has an invalid viewbox attribute – did you mean viewBox?", + "loc": { + "line": 1, + "column": 0 + }, + "pos": 0 +}]