Commits (3)
# html-validate changelog
### [5.0.2](https://gitlab.com/html-validate/html-validate/compare/v5.0.1...v5.0.2) (2021-06-28)
### Bug Fixes
- handle leading and trailing whitespace in `style` attributes ([a71b947](https://gitlab.com/html-validate/html-validate/commit/a71b94747eda26e8e50ff28b1a0269646ee09818)), closes [#122](https://gitlab.com/html-validate/html-validate/issues/122)
### [5.0.1](https://gitlab.com/html-validate/html-validate/compare/v5.0.0...v5.0.1) (2021-06-27)
### Bug Fixes
......
{
"name": "html-validate",
"version": "5.0.1",
"version": "5.0.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "5.0.1",
"version": "5.0.2",
"license": "MIT",
"dependencies": {
"@babel/code-frame": "^7.10.0",
{
"name": "html-validate",
"version": "5.0.1",
"version": "5.0.2",
"description": "Offline html5 validator",
"keywords": [
"html",
......
......@@ -34,6 +34,27 @@ describe("rule no-inline-style", () => {
expect(report).toBeInvalid();
expect(report).toHaveError("no-inline-style", "Inline style is not allowed");
});
it("should handle leading whitespace", () => {
expect.assertions(2);
const report = htmlvalidate.validateString('<p style=" color: red"></p>');
expect(report).toBeInvalid();
expect(report).toHaveError("no-inline-style", "Inline style is not allowed");
});
it("should handle trailing whitespace", () => {
expect.assertions(2);
const report = htmlvalidate.validateString('<p style="color: red; "></p>');
expect(report).toBeInvalid();
expect(report).toHaveError("no-inline-style", "Inline style is not allowed");
});
it("should handle only whitespace", () => {
expect.assertions(2);
const report = htmlvalidate.validateString('<p style=" "></p>');
expect(report).toBeInvalid();
expect(report).toHaveError("no-inline-style", "Inline style is not allowed");
});
});
describe("configured with include", () => {
......
......@@ -21,6 +21,7 @@ const defaults: RuleOptions = {
function getCSSDeclarations(value: string): CSSDeclaration[] {
return value
.trim()
.split(";")
.filter(Boolean)
.map((it): CSSDeclaration => {
......