Crash when "for" contains newline characters
Provide a broad description of the bug.
Reduced test-case
<label for="foo
">
bar
</label>
Same for:
<label for="
foo">
bar
</label>
as well as if newline(s) and optionally spaces there.
Configuration
{
"extends": [
"html-validate:recommended"
],
"root": true
}
Expected result
No crash
Actual result
Validator crashed when parsing "/some/path/file.html"
Caught exception:
TypeError: Cannot read properties of null (reading 'shift')
at new Pattern (/some/path/node_modules/html-validate/dist/cjs/core.js:2023:11)
at /some/path/node_modules/html-validate/dist/cjs/core.js:2083:14
at Function.from ()
at Selector.parse (/some/path/node_modules/html-validate/dist/cjs/core.js:2079:18)
at new Selector (/some/path/node_modules/html-validate/dist/cjs/core.js:2049:29)
at HtmlElement.querySelectorImpl (/some/path/node_modules/html-validate/dist/cjs/core.js:2562:23)
at querySelectorImpl.next ()
at HtmlElement.querySelector (/some/path/node_modules/html-validate/dist/cjs/core.js:2545:21)
at /some/path/node_modules/html-validate/dist/cjs/core.js:7513:30
at /some/path/node_modules/html-validate/dist/cjs/core.js:3604:9
This is a bug in html-validate-8.9.1.
Version
-
html-validate
: 8.9.1