Commit 0bce9dda authored by David Sveningsson's avatar David Sveningsson

feat(elements): <fieldset> requires <legend>

parent 8aaa8015
Pipeline #76911236 passed with stages
in 10 minutes and 42 seconds
......@@ -202,8 +202,8 @@ textual description of the content. E.g. it cannot suggest to use `<abbr>` or
</tr>
<tr>
<td class="table-right">H71</td>
<td>Providing a description for groups of form controls using fieldset and legend elements</td>
<td class="support-planned">Partial planned</td>
<td>Providing a description for groups of form controls using fieldset and legend elements.<em>{@link rule:element-required-content} validates presence of <code>&lt;legend&gt;</code> inside <code>&lt;fieldset&gt;</code>, but not whenever <code>&lt;fieldset&gt;</code> itself is used.</em></td>
<td class="support-yes">Yes</td>
</tr>
<tr>
<td class="table-right">H73</td>
......
......@@ -1632,21 +1632,38 @@ exports[`HTML elements <embed> valid markup 1`] = `Array []`;
exports[`HTML elements <fieldset> invalid markup 1`] = `
Array [
Object {
"errorCount": 1,
"errorCount": 2,
"filePath": "test-files/elements/fieldset-invalid.html",
"messages": Array [
Object {
"column": 2,
"context": Object {
"missing": "legend",
"node": "fieldset",
},
"line": 2,
"message": "<fieldset> element must have <legend> as content",
"offset": 29,
"ruleId": "element-required-content",
"severity": 2,
"size": 8,
},
Object {
"column": 3,
"context": undefined,
"line": 4,
"line": 8,
"message": "Element <legend> must be used before <div> in this context",
"offset": 92,
"offset": 144,
"ruleId": "element-permitted-order",
"severity": 2,
"size": 6,
},
],
"source": "<!-- should not allow legend and flow content out-of-order -->
"source": "<!-- must have <legend> -->
<fieldset>
</fieldset>
<!-- should not allow legend and flow content out-of-order -->
<fieldset>
<div>bar</div>
<legend>foo</legend>
......
......@@ -299,7 +299,8 @@
},
"deprecatedAttributes": ["datafld"],
"permittedContent": ["@flow", "legend?"],
"permittedOrder": ["legend", "@flow"]
"permittedOrder": ["legend", "@flow"],
"requiredContent": ["legend"]
},
"figcaption": {
......
<!-- must have <legend> -->
<fieldset>
</fieldset>
<!-- should not allow legend and flow content out-of-order -->
<fieldset>
<div>bar</div>
......
<!-- should be allowed under flow -->
<div>
<fieldset></fieldset>
<fieldset>
<legend>foo</legend>
</fieldset>
</div>
<!-- should allow legend and flow content in correct order -->
......
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