Commit 8916e19e authored by David Sveningsson's avatar David Sveningsson

fix(elements): <img> must have non-empty src

[skip release]
parent e0d1139d
......@@ -2517,15 +2517,45 @@ exports[`HTML elements <iframe> valid markup 1`] = `Array []`;
exports[`HTML elements <img> invalid markup 1`] = `
Array [
Object {
"errorCount": 2,
"errorCount": 4,
"filePath": "test-files/elements/img-invalid.html",
"messages": Array [
Object {
"column": 11,
"context": undefined,
"column": 2,
"context": Object {
"attribute": "src",
"element": "img",
},
"line": 2,
"message": "<img> is missing required attribute \\"src\\"",
"offset": 34,
"ruleId": "element-required-attributes",
"severity": 2,
"size": 3,
},
Object {
"column": 2,
"context": Object {
"allowed": Array [
/\\.\\+/,
],
"attribute": "src",
"element": "img",
"value": "",
},
"line": 5,
"message": "Attribute \\"src\\" has invalid value \\"\\"",
"offset": 72,
"ruleId": "attribute-allowed-values",
"severity": 2,
"size": 3,
},
Object {
"column": 25,
"context": undefined,
"line": 8,
"message": "End tag for <img> must be omitted",
"offset": 44,
"offset": 143,
"ruleId": "void",
"severity": 2,
"size": 1,
......@@ -2533,20 +2563,26 @@ Array [
Object {
"column": 3,
"context": undefined,
"line": 6,
"line": 12,
"message": "Element <img> is not permitted as descendant of <button>",
"offset": 120,
"offset": 219,
"ruleId": "element-permitted-content",
"severity": 2,
"size": 3,
},
],
"source": "<!-- should not allow end tag -->
<img></img>
"source": "<!-- must have src attribute -->
<img>
<!-- src must be non-empty -->
<img src=\\"\\">
<!-- should not allow end tag -->
<img src=\\"foo.png\\"></img>
<!-- should be interactive if usemap is set -->
<button type=\\"button\\">
<img usemap>
<img src=\\"foo.png\\" usemap>
</button>
",
"warningCount": 0,
......
......@@ -446,7 +446,8 @@
"attributes": {
"crossorigin": ["", "anonymous", "use-credentials"],
"decoding": ["sync", "async", "auto"],
"ismap": []
"ismap": [],
"src": ["/.+/"]
},
"deprecatedAttributes": [
"datasrc",
......@@ -457,7 +458,8 @@
"border",
"hspace",
"vspace"
]
],
"requiredAttributes": ["src"]
},
"input": {
......
<!-- must have src attribute -->
<img>
<!-- src must be non-empty -->
<img src="">
<!-- should not allow end tag -->
<img></img>
<img src="foo.png"></img>
<!-- should be interactive if usemap is set -->
<button type="button">
<img usemap>
<img src="foo.png" usemap>
</button>
<!-- should omit end tag -->
<img>
<img src="foo.png">
<!-- should not be interactive unless usemap is set -->
<button type="button">
<img>
<img src="foo.png">
</button>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment