...
 
Commits (22)
# html-validate changelog
# [2.11.0](https://gitlab.com/html-validate/html-validate/compare/v2.10.0...v2.11.0) (2020-01-26)
### Bug Fixes
- **dom:** use case-insensitive match for `is()` ([d2687c2](https://gitlab.com/html-validate/html-validate/commit/d2687c2e90543044f2fab5480677e6883a5b82cb))
- **plugin:** fix rule type definition ([6f0213d](https://gitlab.com/html-validate/html-validate/commit/6f0213da6f484fea9a51572592b970a7b9a0badd))
### Features
- **dom:** add `generateSelector` ([12e718e](https://gitlab.com/html-validate/html-validate/commit/12e718ec2c18eec34b5a7f9feb317d8ab07d4a13))
- **dom:** new type `DOMInternalID` ([ada3cd3](https://gitlab.com/html-validate/html-validate/commit/ada3cd31bf2fb941a5ccc72fc79515341ff5ba4a))
- **dom:** support pseudo-classes `:first-child`, `:last-child` and `:nth-child` ([af39ea1](https://gitlab.com/html-validate/html-validate/commit/af39ea1d42e2396947b5993766c15ef17481be71))
- **rules:** add selector to reported errors ([6b6ae3d](https://gitlab.com/html-validate/html-validate/commit/6b6ae3da04ae67c44bfda42081de8cbe177c5579))
- **rules:** improved reported error location for some rules ([216b449](https://gitlab.com/html-validate/html-validate/commit/216b4499220befb13b99ad28b2f8fddb811d746f))
- **shim:** expose `Report` ([6091050](https://gitlab.com/html-validate/html-validate/commit/609105017e66899f30dfddae597e9dc016984403))
# [2.10.0](https://gitlab.com/html-validate/html-validate/compare/v2.9.0...v2.10.0) (2020-01-22)
### Features
......
......@@ -13,6 +13,7 @@ Array [
"message": "<img> is missing required \\"alt\\" attribute",
"offset": 1,
"ruleId": "WCAG/H37",
"selector": "img",
"severity": 2,
"size": 3,
},
......@@ -26,6 +27,7 @@ Array [
"message": "<button> is missing required \\"type\\" attribute",
"offset": 22,
"ruleId": "element-required-attributes",
"selector": "button",
"severity": 2,
"size": 6,
},
......@@ -36,6 +38,7 @@ Array [
"message": "<input> element does not have a <label>",
"offset": 130,
"ruleId": "input-missing-label",
"selector": "div > input",
"severity": 2,
"size": 5,
},
......@@ -65,6 +68,7 @@ Array [
"message": "Element <my-block> is not permitted as content in <my-inline>",
"offset": 15,
"ruleId": "element-permitted-content",
"selector": "my-inline > my-block",
"severity": 2,
"size": 8,
},
......@@ -75,6 +79,7 @@ Array [
"message": "<my-deprecated> is deprecated: replaced with <my-other>",
"offset": 39,
"ruleId": "deprecated",
"selector": "my-inline > my-deprecated",
"severity": 2,
"size": 13,
},
......@@ -101,6 +106,7 @@ Array [
"message": "Element <legend> must be used before <p> in this context",
"offset": 65,
"ruleId": "element-permitted-order",
"selector": "footer > fieldset > legend",
"severity": 2,
"size": 6,
},
......@@ -111,6 +117,7 @@ Array [
"message": "Element <main> is not permitted as descendant of <footer>",
"offset": 127,
"ruleId": "element-permitted-content",
"selector": "footer > main",
"severity": 2,
"size": 4,
},
......@@ -121,6 +128,7 @@ Array [
"message": "<blink> is deprecated",
"offset": 138,
"ruleId": "deprecated",
"selector": "footer > main > blink",
"severity": 2,
"size": 5,
},
......
......@@ -16,8 +16,8 @@ main {
header {
.nav > li > a {
@media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
padding-left: 10px;
padding-right: 10px;
padding-left: 8px;
padding-right: 8px;
}
}
}
......
......@@ -47,6 +47,7 @@
<li><a href="/usage/vscode.html">VS Code</a></li>
<li role="separator" class="divider"></li>
<li><a href="/frameworks/angularjs.html">AngularJS</a></li>
<li><a href="/usage/cypress.html">Cypress</a></li>
<li><a href="/usage/grunt.html">Grunt</a></li>
<li><a href="/frameworks/jest.html">Jest</a></li>
<li><a href="/usage/protractor.html">Protractor</a></li>
......
......@@ -13,6 +13,7 @@ Array [
"message": "Element <div> is not permitted as content in <my-component>",
"offset": 76,
"ruleId": "element-permitted-content",
"selector": "my-component:nth-child(2) > div",
"severity": 2,
"size": 3,
},
......
......@@ -13,6 +13,7 @@ Array [
"message": "Attribute \\"quacks\\" should omit value",
"offset": 54,
"ruleId": "attribute-boolean-style",
"selector": "my-component:nth-child(2)",
"severity": 2,
"size": 6,
},
......@@ -28,6 +29,7 @@ Array [
"message": "Attribute \\"quacks\\" has invalid value \\"duck\\"",
"offset": 62,
"ruleId": "attribute-allowed-values",
"selector": "my-component:nth-child(2)",
"severity": 2,
"size": 4,
},
......@@ -52,6 +54,7 @@ Array [
"message": "Attribute \\"duck\\" is deprecated on <my-component> element",
"offset": 14,
"ruleId": "no-deprecated-attr",
"selector": "my-component",
"severity": 2,
"size": 4,
},
......@@ -85,6 +88,7 @@ Array [
"message": "Attribute \\"duck\\" has invalid value \\"flintheart\\"",
"offset": 66,
"ruleId": "attribute-allowed-values",
"selector": "my-component:nth-child(2)",
"severity": 2,
"size": 10,
},
......@@ -116,6 +120,7 @@ Array [
"message": "Attribute \\"ducks\\" has invalid value \\"huey\\"",
"offset": 64,
"ruleId": "attribute-allowed-values",
"selector": "my-component:nth-child(2)",
"severity": 2,
"size": 4,
},
......@@ -143,6 +148,7 @@ Array [
"message": "<my-component> is missing required \\"duck\\" attribute",
"offset": 47,
"ruleId": "element-required-attributes",
"selector": "my-component:nth-child(2)",
"severity": 2,
"size": 12,
},
......
......@@ -13,6 +13,7 @@ Array [
"message": "Element <footer> is not permitted as descendant of <my-component>",
"offset": 63,
"ruleId": "element-permitted-content",
"selector": "my-component > div > footer",
"severity": 2,
"size": 6,
},
......@@ -23,6 +24,7 @@ Array [
"message": "Element <my-component> is not permitted as descendant of <my-component>",
"offset": 137,
"ruleId": "element-permitted-content",
"selector": "my-component > div > my-component",
"severity": 2,
"size": 12,
},
......@@ -58,6 +60,7 @@ Array [
"message": "Element <h1> is not permitted as content in <my-component>",
"offset": 67,
"ruleId": "element-permitted-content",
"selector": "my-component > h1",
"severity": 2,
"size": 2,
},
......@@ -85,6 +88,7 @@ Array [
"message": "Element <button> is not permitted as content in <my-component>",
"offset": 18,
"ruleId": "element-permitted-content",
"selector": "my-component > button",
"severity": 2,
"size": 6,
},
......
......@@ -13,6 +13,7 @@ Array [
"message": "Element <my-component> is not permitted as content in <div>",
"offset": 9,
"ruleId": "element-permitted-content",
"selector": "div > my-component",
"severity": 2,
"size": 12,
},
......@@ -38,6 +39,7 @@ Array [
"message": "Element <my-component> is not permitted as content in <span>",
"offset": 10,
"ruleId": "element-permitted-content",
"selector": "span > my-component",
"severity": 2,
"size": 12,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Attribute \\"ID\\" should be lowercase",
"offset": 3,
"ruleId": "attr-case",
"selector": "p",
"severity": 2,
"size": 2,
},
......@@ -38,6 +39,7 @@ Array [
"message": "Attribute \\"fooBar\\" should be lowercase or uppercase",
"offset": 33,
"ruleId": "attr-case",
"selector": "p:nth-child(3)",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Attribute \\"class\\" used ' instead of expected \\"",
"offset": 3,
"ruleId": "attr-quotes",
"selector": "p",
"severity": 2,
"size": 5,
},
......
......@@ -43,6 +43,7 @@ Array [
"message": "Attribute \\"type\\" has invalid value \\"foobar\\"",
"offset": 13,
"ruleId": "attribute-allowed-values",
"selector": "input",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Attribute \\"required\\" should omit value",
"offset": 7,
"ruleId": "attribute-boolean-style",
"selector": "input:nth-child(1)",
"severity": 2,
"size": 8,
},
......@@ -25,6 +26,7 @@ Array [
"message": "Attribute \\"required\\" should omit value",
"offset": 27,
"ruleId": "attribute-boolean-style",
"selector": "input:nth-child(2)",
"severity": 2,
"size": 8,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Class \\"fooBar\\" does not match required pattern \\"/^[a-z0-9-]+$/\\"",
"offset": 12,
"ruleId": "class-pattern",
"selector": "div",
"severity": 2,
"size": 6,
},
......
......@@ -9,14 +9,15 @@ Array [
"filePath": "inline",
"messages": Array [
Object {
"column": 20,
"column": 12,
"context": undefined,
"line": 1,
"message": "Close tags cannot have attributes",
"offset": 19,
"offset": 11,
"ruleId": "close-attr",
"selector": null,
"severity": 2,
"size": 1,
"size": 2,
},
],
"source": "<div></div id=\\"foo\\">",
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`docs/rules/close-order.md inline validation: correct 1`] = `Array []`;
exports[`docs/rules/close-order.md inline validation: correct-1 1`] = `Array []`;
exports[`docs/rules/close-order.md inline validation: incorrect 1`] = `
exports[`docs/rules/close-order.md inline validation: correct-2 1`] = `Array []`;
exports[`docs/rules/close-order.md inline validation: incorrect-1 1`] = `
Array [
Object {
"errorCount": 2,
......@@ -11,25 +13,78 @@ Array [
Object {
"column": 13,
"context": undefined,
"line": 1,
"line": 2,
"message": "Mismatched close-tag, expected '</strong>' but found '</p>'.",
"offset": 12,
"offset": 43,
"ruleId": "close-order",
"selector": null,
"severity": 2,
"size": 2,
},
Object {
"column": 17,
"context": undefined,
"line": 1,
"line": 2,
"message": "Mismatched close-tag, expected '</p>' but found '</strong>'.",
"offset": 16,
"offset": 47,
"ruleId": "close-order",
"selector": null,
"severity": 2,
"size": 7,
},
],
"source": "<p><strong></p></strong>",
"source": "<!-- closed in wrong order -->
<p><strong></p></strong>",
"warningCount": 0,
},
]
`;
exports[`docs/rules/close-order.md inline validation: incorrect-2 1`] = `
Array [
Object {
"errorCount": 1,
"filePath": "inline",
"messages": Array [
Object {
"column": 6,
"context": undefined,
"line": 2,
"message": "Missing close-tag, expected '</div>' but document ended before it was found.",
"offset": 36,
"ruleId": "close-order",
"selector": null,
"severity": 2,
"size": 0,
},
],
"source": "<!-- opened but not closed -->
<div>",
"warningCount": 0,
},
]
`;
exports[`docs/rules/close-order.md inline validation: incorrect-3 1`] = `
Array [
Object {
"errorCount": 1,
"filePath": "inline",
"messages": Array [
Object {
"column": 2,
"context": undefined,
"line": 2,
"message": "Unexpected close-tag, expected opening tag.",
"offset": 32,
"ruleId": "close-order",
"selector": null,
"severity": 2,
"size": 4,
},
],
"source": "<!-- closed but not opened -->
</div>",
"warningCount": 0,
},
]
......
......@@ -15,6 +15,7 @@ Array [
"message": "<my-element> is deprecated: replaced with <other-element>",
"offset": 1,
"ruleId": "deprecated",
"selector": "my-element",
"severity": 2,
"size": 10,
},
......@@ -38,6 +39,7 @@ Array [
"message": "<center> is deprecated",
"offset": 1,
"ruleId": "deprecated",
"selector": "center",
"severity": 2,
"size": 6,
},
......@@ -48,6 +50,7 @@ Array [
"message": "<big> is deprecated",
"offset": 22,
"ruleId": "deprecated",
"selector": "big",
"severity": 2,
"size": 3,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "doctype should be \\"html\\"",
"offset": 10,
"ruleId": "doctype-html",
"selector": null,
"severity": 2,
"size": 79,
},
......@@ -38,6 +39,7 @@ Array [
"message": "doctype should be \\"html\\"",
"offset": 10,
"ruleId": "doctype-html",
"selector": null,
"severity": 2,
"size": 33,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Element \\"DIV\\" should be lowercase",
"offset": 1,
"ruleId": "element-case",
"selector": "div",
"severity": 2,
"size": 3,
},
......@@ -38,6 +39,7 @@ Array [
"message": "Start and end tag must not differ in casing",
"offset": 12,
"ruleId": "element-case",
"selector": "foobar",
"severity": 2,
"size": 7,
},
......@@ -61,6 +63,7 @@ Array [
"message": "Element \\"fooBar\\" should be lowercase or PascalCase",
"offset": 39,
"ruleId": "element-case",
"selector": "foobar:nth-child(3)",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<foobar> is not a valid element name",
"offset": 1,
"ruleId": "element-name",
"selector": "foobar",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Element <li> is not permitted as content in <div>",
"offset": 69,
"ruleId": "element-permitted-content",
"selector": "div > li",
"severity": 2,
"size": 2,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Element <tfoot> can only appear once under <table>",
"offset": 77,
"ruleId": "element-permitted-occurrences",
"selector": "table > tfoot:nth-child(2)",
"severity": 2,
"size": 5,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Element <caption> must be used before <thead> in this context",
"offset": 82,
"ruleId": "element-permitted-order",
"selector": "table > caption",
"severity": 2,
"size": 7,
},
......
......@@ -18,6 +18,7 @@ Array [
"message": "<input> is missing required \\"type\\" attribute",
"offset": 1,
"ruleId": "element-required-attributes",
"selector": "input",
"severity": 2,
"size": 5,
},
......
......@@ -18,6 +18,7 @@ Array [
"message": "<html> element must have <body> as content",
"offset": 1,
"ruleId": "element-required-content",
"selector": "html",
"severity": 2,
"size": 4,
},
......@@ -31,6 +32,7 @@ Array [
"message": "<head> element must have <title> as content",
"offset": 12,
"ruleId": "element-required-content",
"selector": "html > head",
"severity": 2,
"size": 4,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<h1> cannot be empty, must have text content",
"offset": 1,
"ruleId": "empty-heading",
"selector": "h1",
"severity": 2,
"size": 2,
},
......@@ -25,6 +26,7 @@ Array [
"message": "<h2> cannot be empty, must have text content",
"offset": 11,
"ruleId": "empty-heading",
"selector": "h2",
"severity": 2,
"size": 2,
},
......@@ -49,6 +51,7 @@ Array [
"message": "<h1> cannot be empty, must have text content",
"offset": 1,
"ruleId": "empty-heading",
"selector": "h1",
"severity": 2,
"size": 2,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<title> cannot be empty, must have text content",
"offset": 25,
"ruleId": "empty-title",
"selector": "head > title",
"severity": 2,
"size": 1,
},
......@@ -40,6 +41,7 @@ Array [
"message": "<title> cannot be empty, must have text content",
"offset": 26,
"ruleId": "empty-title",
"selector": "head > title",
"severity": 2,
"size": 1,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Heading level can only increase by one, expected h2",
"offset": 20,
"ruleId": "heading-level",
"selector": "h3",
"severity": 2,
"size": 2,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "ID \\"fooBar\\" does not match required pattern \\"/^[a-z0-9-]+$/\\"",
"offset": 9,
"ruleId": "id-pattern",
"selector": "div",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<input> element does not have a <label>",
"offset": 74,
"ruleId": "input-missing-label",
"selector": "div:nth-child(1) > input",
"severity": 2,
"size": 5,
},
......@@ -25,6 +26,7 @@ Array [
"message": "<textarea> element does not have a <label>",
"offset": 98,
"ruleId": "input-missing-label",
"selector": "div:nth-child(1) > textarea",
"severity": 2,
"size": 8,
},
......@@ -35,6 +37,7 @@ Array [
"message": "<select> element does not have a <label>",
"offset": 124,
"ruleId": "input-missing-label",
"selector": "div:nth-child(1) > select",
"severity": 2,
"size": 6,
},
......@@ -45,6 +48,7 @@ Array [
"message": "<input> element does not have a <label>",
"offset": 253,
"ruleId": "input-missing-label",
"selector": "div:nth-child(2) > input",
"severity": 2,
"size": 5,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "title text cannot be longer than 70 characters",
"offset": 148,
"ruleId": "long-title",
"selector": "head > title",
"severity": 2,
"size": 1,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Meta refresh must use 0 second delay",
"offset": 36,
"ruleId": "meta-refresh",
"selector": "meta",
"severity": 2,
"size": 17,
},
......@@ -38,6 +39,7 @@ Array [
"message": "Don't use meta refresh to reload the page",
"offset": 36,
"ruleId": "meta-refresh",
"selector": "meta",
"severity": 2,
"size": 1,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Document is missing doctype",
"offset": 0,
"ruleId": "missing-doctype",
"selector": null,
"severity": 2,
"size": 0,
},
......
......@@ -13,6 +13,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 0,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 12,
},
......@@ -23,6 +24,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 53,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 12,
},
......@@ -33,6 +35,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 67,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 11,
},
......@@ -43,6 +46,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 123,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 10,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Attribute \\"bgcolor\\" is deprecated on <body> element",
"offset": 6,
"ruleId": "no-deprecated-attr",
"selector": "body",
"severity": 2,
"size": 7,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Attribute \\"class\\" duplicated",
"offset": 17,
"ruleId": "no-dup-attr",
"selector": "div",
"severity": 2,
"size": 5,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Class \\"foo\\" duplicated",
"offset": 12,
"ruleId": "no-dup-class",
"selector": "div",
"severity": 2,
"size": 11,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Duplicate ID \\"foo\\"",
"offset": 30,
"ruleId": "no-dup-id",
"selector": "div:nth-child(2)",
"severity": 2,
"size": 3,
},
......
......@@ -13,6 +13,7 @@ Array [
"message": "Element <p> is implicitly closed by adjacent <div>",
"offset": 1,
"ruleId": "no-implicit-close",
"selector": "p",
"severity": 2,
"size": 1,
},
......@@ -42,6 +43,7 @@ Array [
"message": "Element <li> is implicitly closed by sibling",
"offset": 10,
"ruleId": "no-implicit-close",
"selector": "ul > li:nth-child(1)",
"severity": 2,
"size": 2,
},
......@@ -52,6 +54,7 @@ Array [
"message": "Element <li> is implicitly closed by sibling",
"offset": 22,
"ruleId": "no-implicit-close",
"selector": "ul > li:nth-child(2)",
"severity": 2,
"size": 2,
},
......@@ -62,6 +65,7 @@ Array [
"message": "Element <li> is implicitly closed by parent </ul>",
"offset": 34,
"ruleId": "no-implicit-close",
"selector": "ul > li:nth-child(3)",
"severity": 2,
"size": 2,
},
......@@ -89,6 +93,7 @@ Array [
"message": "Element <p> is implicitly closed by sibling",
"offset": 1,
"ruleId": "no-implicit-close",
"selector": "p:nth-child(1)",
"severity": 2,
"size": 1,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Inline style is not allowed",
"offset": 3,
"ruleId": "no-inline-style",
"selector": "p",
"severity": 2,
"size": 5,
},
......
......@@ -18,6 +18,7 @@ Array [
"message": "Element references missing id \\"missing-input\\"",
"offset": 12,
"ruleId": "no-missing-references",
"selector": "label",
"severity": 2,
"size": 13,
},
......@@ -31,6 +32,7 @@ Array [
"message": "Element references missing id \\"missing-text\\"",
"offset": 58,
"ruleId": "no-missing-references",
"selector": "div:nth-child(2)",
"severity": 2,
"size": 12,
},
......@@ -44,6 +46,7 @@ Array [
"message": "Element references missing id \\"missing-text\\"",
"offset": 102,
"ruleId": "no-missing-references",
"selector": "div:nth-child(3)",
"severity": 2,
"size": 12,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Raw \\"&\\" must be encoded as \\"&amp;\\"",
"offset": 8,
"ruleId": "no-raw-characters",
"selector": "p",
"severity": 2,
"size": 1,
},
......@@ -25,6 +26,7 @@ Array [
"message": "Raw \\"'\\" must be encoded as \\"&apos;\\"",
"offset": 33,
"ruleId": "no-raw-characters",
"selector": "p:nth-child(2)",
"severity": 2,
"size": 1,
},
......@@ -48,6 +50,7 @@ Array [
"message": "failed to tokenize \\"</p>\\", expected attribute, \\">\\" or \\"/>\\".",
"offset": 17,
"ruleId": "parser-error",
"selector": null,
"severity": 2,
"size": 0,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Use external stylesheet with <link> instead of <style> tag",
"offset": 0,
"ruleId": "no-style-tag",
"selector": "style",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Unknown element <custom-element>",
"offset": 0,
"ruleId": "no-unknown-elements",
"selector": "custom-element",
"severity": 2,
"size": 15,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Prefer to use <button> instead of <input type=\\"button\\"> when adding buttons",
"offset": 13,
"ruleId": "prefer-button",
"selector": "input",
"severity": 2,
"size": 6,
},
......
......@@ -18,6 +18,7 @@ Array [
"message": "Prefer to use the native <main> element",
"offset": 5,
"ruleId": "prefer-native-element",
"selector": "div",
"severity": 2,
"size": 11,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Prefer to wrap <tr> elements in <tbody>",
"offset": 10,
"ruleId": "prefer-tbody",
"selector": "table > tr",
"severity": 2,
"size": 2,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "SRI \\"integrity\\" attribute is required on <link> element",
"offset": 85,
"ruleId": "require-sri",
"selector": "link:nth-child(2)",
"severity": 2,
"size": 4,
},
......@@ -42,6 +43,7 @@ Array [
"message": "SRI \\"integrity\\" attribute is required on <script> element",
"offset": 1,
"ruleId": "require-sri",
"selector": "script",
"severity": 2,
"size": 6,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<svg> is missing required \\"focusable\\" attribute",
"offset": 15,
"ruleId": "svg-focusable",
"selector": "a > svg",
"severity": 2,
"size": 3,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "Unrecognized character reference \\"&foobar;\\"",
"offset": 3,
"ruleId": "unrecognized-char-ref",
"selector": null,
"severity": 2,
"size": 8,
},
......
......@@ -15,18 +15,20 @@ Array [
"message": "Expected omitted end tag <input> instead of self-closing element <input/>",
"offset": 21,
"ruleId": "void",
"selector": "fieldset > input",
"severity": 2,
"size": 2,
},
Object {
"column": 11,
"column": 7,
"context": undefined,
"line": 5,
"message": "End tag for <img> must be omitted",
"offset": 47,
"offset": 43,
"ruleId": "void",
"selector": null,
"severity": 2,
"size": 1,
"size": 4,
},
],
"source": "<fieldset>
......
import HtmlValidate from "../../../src/htmlvalidate";
const markup: { [key: string]: string } = {};
markup["incorrect"] = `<p><strong></p></strong>`;
markup["correct"] = `<p><strong></strong></p>`;
markup["incorrect-1"] = `<!-- closed in wrong order -->
<p><strong></p></strong>`;
markup["incorrect-2"] = `<!-- opened but not closed -->
<div>`;
markup["incorrect-3"] = `<!-- closed but not opened -->
</div>`;
markup["correct-1"] = `<p><strong></strong></p>`;
markup["correct-2"] = `<div></div>`;
describe("docs/rules/close-order.md", () => {
it("inline validation: incorrect", () => {
it("inline validation: incorrect-1", () => {
const htmlvalidate = new HtmlValidate({"rules":{"close-order":"error"}});
const report = htmlvalidate.validateString(markup["incorrect"]);
const report = htmlvalidate.validateString(markup["incorrect-1"]);
expect(report.results).toMatchSnapshot();
});
it("inline validation: correct", () => {
it("inline validation: incorrect-2", () => {
const htmlvalidate = new HtmlValidate({"rules":{"close-order":"error"}});
const report = htmlvalidate.validateString(markup["correct"]);
const report = htmlvalidate.validateString(markup["incorrect-2"]);
expect(report.results).toMatchSnapshot();
});
it("inline validation: incorrect-3", () => {
const htmlvalidate = new HtmlValidate({"rules":{"close-order":"error"}});
const report = htmlvalidate.validateString(markup["incorrect-3"]);
expect(report.results).toMatchSnapshot();
});
it("inline validation: correct-1", () => {
const htmlvalidate = new HtmlValidate({"rules":{"close-order":"error"}});
const report = htmlvalidate.validateString(markup["correct-1"]);
expect(report.results).toMatchSnapshot();
});
it("inline validation: correct-2", () => {
const htmlvalidate = new HtmlValidate({"rules":{"close-order":"error"}});
const report = htmlvalidate.validateString(markup["correct-2"]);
expect(report.results).toMatchSnapshot();
});
});
......@@ -4,7 +4,7 @@ name: close-order
summary: Require elements to be closed in correct order
---
# disallows elements closed in the wrong order (`close-order`)
# Disallows elements closed in the wrong order (`close-order`)
HTML requires elements to be closed in the correct order.
......@@ -12,12 +12,27 @@ HTML requires elements to be closed in the correct order.
Examples of **incorrect** code for this rule:
<validate name="incorrect" rules="close-order">
<validate name="incorrect-1" rules="close-order">
<!-- closed in wrong order -->
<p><strong></p></strong>
</validate>
<validate name="incorrect-2" rules="close-order">
<!-- opened but not closed -->
<div>
</validate>
<validate name="incorrect-3" rules="close-order">
<!-- closed but not opened -->
</div>
</validate>
Examples of **correct** code for this rule:
<validate name="correct" rules="close-order">
<validate name="correct-1" rules="close-order">
<p><strong></strong></p>
</validate>
<validate name="correct-2" rules="close-order">
<div></div>
</validate>
......@@ -15,6 +15,7 @@ Array [
"message": "Anchor link must have a text describing its purpose",
"offset": 1,
"ruleId": "WCAG/H30",
"selector": "a",
"severity": 2,
"size": 1,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<form> element must have a submit button",
"offset": 1,
"ruleId": "WCAG/H32",
"selector": "form",
"severity": 2,
"size": 4,
},
......
......@@ -19,6 +19,7 @@ Array [
"message": "<img> is missing required \\"alt\\" attribute",
"offset": 1,
"ruleId": "WCAG/H37",
"selector": "img",
"severity": 2,
"size": 3,
},
......
......@@ -15,6 +15,7 @@ Array [
"message": "<img> with empty alt text cannot have title attribute",
"offset": 5,
"ruleId": "WCAG/H67",
"selector": "img",
"severity": 2,
"size": 5,
},
......
---
docType: content
title: Cypress plugin
---
# Cypress plugin
To validate browser source from cypress:
npm install --save-dev cypress-html-validate
See [cypress-html-validate][npm] for details.
[npm]: https://www.npmjs.com/package/cypress-html-validate
## Usage
In `cypress/plugins/index.js`:
```js
const htmlvalidate = require("cypress-html-validate/dist/plugin");
module.exports = on => {
htmlvalidate.install(on);
};
```
`cypress/support/index.js`:
```js
import "cypress-html-validate/dist/commands";
```
In specs:
```js
it("should be valid", () => {
cy.visit("/my-page.html");
cy.htmlvalidate();
});
```
## Configuration
`html-validate` configuration can be passed in `cypress/plugins/index.js`:
```js
htmlvalidate.install(on, {
rules: {
foo: "error",
},
});
```
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "html-validate",
"version": "2.10.0",
"version": "2.11.0",
"description": "html linter",
"keywords": [
"html",
......@@ -105,7 +105,7 @@
"@types/estree": "0.0.42",
"@types/glob": "7.1.1",
"@types/inquirer": "6.5.0",
"@types/jest": "24.9.0",
"@types/jest": "24.9.1",
"@types/json-merge-patch": "0.0.4",
"@types/minimist": "1.2.0",
"@types/node": "11.15.4",
......@@ -133,20 +133,20 @@
"grunt-postcss": "0.9.0",
"grunt-sass": "3.1.0",
"highlight.js": "9.18.0",
"husky": "4.0.10",
"jest": "24.9.0",
"jest-diff": "24.9.0",
"husky": "4.2.1",
"jest": "25.1.0",
"jest-diff": "25.1.0",
"jest-junit": "10.0.0",
"jquery": "3.4.1",
"lint-staged": "10.0.1",
"lint-staged": "10.0.2",
"load-grunt-tasks": "5.1.0",
"minimatch": "3.0.4",
"prettier": "1.19.1",
"sass": "1.25.0",
"semantic-release": "16.0.2",
"semantic-release": "16.0.3",
"serve-static": "1.14.1",
"strip-ansi": "6.0.0",
"ts-jest": "24.3.0",
"ts-jest": "25.0.0",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"typescript": "3.7.5"
......
......@@ -41,7 +41,7 @@ exports[`toHaveError() should fail if error has mismatched context 1`] = `
Expected token to equal:
[ObjectContaining {\\"context\\": {\\"foo\\": \\"spam\\"}, \\"message\\": \\"mock message\\", \\"ruleId\\": \\"my-rule\\"}]
Received:
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"severity\\": 2, \\"size\\": 12}]
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"selector\\": null, \\"severity\\": 2, \\"size\\": 12}]
Difference:
......@@ -60,6 +60,7 @@ Difference:
\\"message\\": \\"mock message\\",
+ \\"offset\\": 43,
\\"ruleId\\": \\"my-rule\\",
+ \\"selector\\": null,
+ \\"severity\\": 2,
+ \\"size\\": 12,
},
......@@ -72,7 +73,7 @@ exports[`toHaveError() should fail if error is missing 1`] = `
Expected token to equal:
[ObjectContaining {\\"message\\": \\"asdf\\", \\"ruleId\\": \\"asdf\\"}]
Received:
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"severity\\": 2, \\"size\\": 12}]
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"selector\\": null, \\"severity\\": 2, \\"size\\": 12}]
Difference:
......@@ -92,6 +93,7 @@ Difference:
+ \\"message\\": \\"mock message\\",
+ \\"offset\\": 43,
+ \\"ruleId\\": \\"my-rule\\",
+ \\"selector\\": null,
+ \\"severity\\": 2,
+ \\"size\\": 12,
},
......@@ -104,7 +106,7 @@ exports[`toHaveErrors() should fail if error any missing 1`] = `
Expected token to equal:
[ObjectContaining {\\"message\\": \\"mock message\\", \\"ruleId\\": \\"my-rule\\"}, ObjectContaining {\\"message\\": \\"spam\\", \\"ruleId\\": \\"spam\\"}]
Received:
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"severity\\": 2, \\"size\\": 12}, {\\"column\\": 15, \\"line\\": 2, \\"message\\": \\"another message\\", \\"offset\\": 43, \\"ruleId\\": \\"another-rule\\", \\"severity\\": 2, \\"size\\": 12}]
[{\\"column\\": 15, \\"context\\": {\\"foo\\": \\"bar\\"}, \\"line\\": 2, \\"message\\": \\"mock message\\", \\"offset\\": 43, \\"ruleId\\": \\"my-rule\\", \\"selector\\": null, \\"severity\\": 2, \\"size\\": 12}, {\\"column\\": 15, \\"line\\": 2, \\"message\\": \\"another message\\", \\"offset\\": 43, \\"ruleId\\": \\"another-rule\\", \\"selector\\": null, \\"severity\\": 2, \\"size\\": 12}]
Difference:
......@@ -122,6 +124,7 @@ Difference:
\\"message\\": \\"mock message\\",
+ \\"offset\\": 43,
\\"ruleId\\": \\"my-rule\\",
+ \\"selector\\": null,
+ \\"severity\\": 2,
+ \\"size\\": 12,
},
......@@ -134,6 +137,7 @@ Difference:
+ \\"message\\": \\"another message\\",
+ \\"offset\\": 43,
+ \\"ruleId\\": \\"another-rule\\",
+ \\"selector\\": null,
+ \\"severity\\": 2,
+ \\"size\\": 12,
},
......
......@@ -17,6 +17,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 16,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 17,
},
......@@ -27,6 +28,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 75,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 12,
},
......@@ -37,6 +39,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 88,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 14,
},
......@@ -47,6 +50,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 147,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 12,
},
......@@ -57,6 +61,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 160,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 14,
},
......@@ -67,6 +72,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 219,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 12,
},
......@@ -77,6 +83,7 @@ Array [
"message": "Use of conditional comments are deprecated",
"offset": 232,
"ruleId": "no-conditional-comment",
"selector": null,
"severity": 2,
"size": 17,
},
......@@ -87,6 +94,7 @@ Array [