Changelog
8.26.0 (2024-11-26)
Features
8.25.1 (2024-11-24)
Bug Fixes
- fix dump tree output with nested elements (854c274)
8.25.0 (2024-11-11)
Features
Bug Fixes
- properly close elements with optional end tag when implicit document element is used (bbe2a99), closes #268
- types: narrow numeric rule severity to only 0, 1 and 2 (88cf8a2)
8.24.2 (2024-10-16)
Bug Fixes
8.24.1 (2024-10-07)
Bug Fixes
- dont validate quotes in dynamically added attributes (2125d86)
8.24.0 (2024-09-24)
Features
8.23.0 (2024-09-22)
Features
- deps: support vitest v2 (860b0c0)
9.0.0-rc.2 (2024-09-21)
⚠ BREAKING CHANGES
- api: This change affects API users only.
Config.fromFile(..)
andConfig.fromObject(..)
will return a Promise when used with an async loader or resolver. - api: This change affects API users only.
ConfigLoader
methods can optionally return aPromise
for async operation. For most use-cases this will not require any changes. - api: This change affects API users only. The
ConfigLoader.globalConfig
property has been replaced withConfigLoader.getGlobalConfig()
(async) andConfigLoader.getGlobalConfigSync()
(sync).
Features
- api:
Config.fromFile
andConfig.fromObject
can returnPromise
(2d827f8) - api:
ConfigLoader
s can optionally returnPromise
for async operation (ccea523) - api: replace
ConfigLoader.globalConfig
withConfigLoader.getGlobalConfig()
(404d44e)
9.0.0-rc.1 (2024-09-09)
⚠ BREAKING CHANGES
- api: This change only affects API users. The
ConfigLoader.getConfigFor()
method may now optionally return and asynchronousPromise
. For most use-cases this will not require any changes.
Features
- api:
ConfigLoader.getConfigFor()
may return Promise-based async results (eb05356)
8.22.0 (2024-09-09)
Features
- api: make
DOMNode
constructor internal (13377ac) - api: make
HtmlElement
constructor private (fbf4303) - deps: drop
@babel/code-frame
dependency (0003ffd) - deps: update @sidvind/better-ajv-errors to v3 (3112289)
Bug Fixes
- deps: update dependency ignore to v5.3.2 (9d86e68)
8.21.0 (2024-07-20)
Features
- api: add
DOMTree.readyState
(1f6f69b) - api: deprecate
DOMTree.find(..)
in favour ofquerySelector(..)
(ac0bb77) - api: internal methods of
DOMTree
removed from public API (79a03be) - api: new
walk.depthFirst(..)
API to replace now deprecatedDOMTree.visitDepthFirst(..)
method (f9dbda0)
Bug Fixes
- html5:
spellcheck
is a global attribute (46594a1)
8.20.1 (2024-06-11)
Bug Fixes
- rules: fix
attribute-allowed-values
error location for empty values (2c04eeb)
8.20.0 (2024-06-02)
Features
- api: new
setConfig
method onStaticConfigLoader
to change config (1bf7559) - api: new getter/setter for configuration loader (6283091)
8.19.1 (2024-05-23)
Bug Fixes
- rules:
wcag/h36
no longer reports for hidden elements (aba06d1) - rules:
wcag/h37
no longer validates<input type="submit">
(usewcag/h36
instead) (e82b17a), closes #254 - rules: make
wcag/h36
have better message and location (8a80cc8)
8.19.0 (2024-05-18)
Features
Bug Fixes
- rules:
multiple-labeled-controls
handles hidden input (4d794b6), closes #251 - rules:
wcag/h30
only applies to<a href>
(cd93dfe), closes #252 - rules: handle unicode letters in
valid-id
(c83687a), closes #253
8.18.2 (2024-04-20)
Bug Fixes
8.18.1 (2024-03-30)
Bug Fixes
- rules:
form-dup-name
handles<template>
element (9c77444), closes #247 - rules:
no-dup-id
handles<template>
element (04f3e0d), closes #247
8.18.0 (2024-03-23)
Features
- rules: new pattern
bem
for pattern rules (c1ead1b) - rules: new pattern
snakecase
for pattern rules (4b95ccb), closes #245
Bug Fixes
- rules: disallow consecutive hyphens and underscors for kebab-case and snake_case (a4338a7), closes #246
- rules: require initial character for all patterns to be letter (646ff16)
8.17.1 (2024-03-21)
Bug Fixes
8.17.0 (2024-03-19)
Features
- rules: new rule
name-pattern
(f2209c0), closes #216 - rules: support multiple patterns in
id-pattern
,class-pattern
andname-pattern
rules (15dd007)
Bug Fixes
- meta: handle regexp with slash inside (4c88396), closes #242
- rules:
input-missing-label
now ignores<input>
hidden by css (c40e48e), closes #241 - rules:
input-missing-label
now tests if<label>
is inert or hidden by css (d0d6f40) - rules: show pattern name in
id-pattern
,class-pattern
andname-pattern
rules (4bd70ab)
8.16.0 (2024-03-18)
Features
- api: new
tabIndex
property reflecting the parsedtabindex
attribute (a4e5d5b) - meta: add
inert
as global attribute (a5e6477) - meta: new
formAssociated.disablable
property (0b141ab)
Bug Fixes
- html5:
<summary>
element is focusable if child of<details>
(79dec74) - rules:
hidden-focusable
handles inert elements (89bb969), closes #240 - rules:
hidden-focusable
no longer reports for disabled form controls (d337397) - rules:
hidden-focusable
no longer reports for elements withtabindex="-1"
(03d7223), closes #240
8.15.0 (2024-03-11)
Features
- rules: new rule
valid-autocomplete
(bebd0d1)
Bug Fixes
- rules: case-insensitive match for
url
inmeta-refresh
(3177295)
8.14.0 (2024-03-09)
Features
- rules: new option
allowLongDelay
tometa-refresh
to allow 20h+ delays (629625c)
8.13.0 (2024-03-06)
Features
- meta: allow
<link>
under<body>
if appropriaterel
attribute is present (ae1e070) - meta: allow content categories to be a callback (0eb4e77)
- meta: disallow invalid rel attribute keywords (dc36cfb)
8.12.0 (2024-03-04)
Features
- rules: new rule
no-abstract-role
(923680b)
8.11.1 (2024-02-26)
Bug Fixes
- dom: fix regression error with selectors ending with characters
a
,d
or9
(a9a9ef9)
8.11.0 (2024-02-26)
Features
- html5: add new property
aria.naming
representing if the element can be named (4fca264) - html5: update role metadata from html-aria standard (b029a3f)
- meta: move
implicitRole
toaria.implicitRole
(bc8cacf)
Bug Fixes
- handle selectors containing tabs and newlines (5e45d54), closes #238
- rules: new option
allowAnyNamable
foraria-label-misuse
(c08a3ba), closes #237
8.10.0 (2024-02-21)
Features
- rules: new rule
no-implicit-input-type
(6cc0c6d)
Bug Fixes
- deps: update dependency ignore to v5.3.1 (4553b89)
- html5:
type
for<input>
no longer required (37284d0), closes #235 - rules: change wording required to recommended in
no-implicit-button-type
(1926c06)
8.9.1 (2024-01-10)
Bug Fixes
- rules:
<form>
and<section>
without explicit accessible name is no longer considered landmark (a36deac) - rules:
<header>
and<footer>
nested in<main>
or sectioning content is no longer considered landmark (bcab354), closes #234
8.9.0 (2024-01-08)
Features
- elements: new property
focusable
to mark elements as focusable (c59c8b2) - rules: new rule
hidden-focusable
(243e7fb) - rules: new rule
unique-landmark
(187be1e)
Bug Fixes
- api: remove internal
listeners
property from public API (303e5d5) - dom: ancestor with
role="presentation"
no longer counts decendants as missing from a11y tree (cc72da1) - dom: handle
role="none"
as a synonym forrole="presentation"
(b1d7b50) - dom: interactive and focusable elements ignore
role="presentation"
(017308f) - rules: better error description for
require-sri
(ffc3695) - rules: rule
wcag/h30
no longer requires text on<a hidden>
(a20cc84) - rules: rule
wcag/h30
no longer requires text on links withdisplay: none
orvisibility: hidden
(36ff07e) - rules: rules
wcag/h32
handles<button>
without explicittype
(84c6a6e)
8.8.0 (2023-12-27)
Features
- api:
Report.merge()
can merge async results (35689fc) - api: rename
nodejsResolver
tocjsResolver
(8c72c8f) - config: new
defineConfig
helper (35e265a)
Bug Fixes
- config: proper error message when certain configuration properties was invalid (b029569)
8.7.4 (2023-12-10)
Bug Fixes
8.7.3 (2023-11-23)
Bug Fixes
- disable
doctype-style
when using prettier preset (f1f4004)
8.7.2 (2023-11-18)
Bug Fixes
- deps: update dependency ignore to v5.3.0 (143e994)
8.7.1 (2023-11-11)
Bug Fixes
8.7.0 (2023-10-21)
Features
- html5: support
referrerpolicy
attribute (851b559)
8.6.1 (2023-10-21)
Bug Fixes
- dom: remove usage of regex negative lookbehind (f406393), closes #147
- rules: improve
attribute-misuse
error message (fccce69), closes #226 - typo in CONTRIBUTING.md (855bacf)
8.6.0 (2023-10-13)
Features
- api: add
meta: MetaAttribute
inAttributeEvent
(2cda0ae) - cli:
--rule
severity can now be set with strings, fixes #225. (054972e)
8.5.0 (2023-10-01)
Features
8.4.1 (2023-09-23)
Bug Fixes
- rules: fix contextual documentation for
attr-pattern
rule (0082aef)
8.4.0 (2023-09-09)
Features
- html5: support
<search>
element (720bdd9) - new
implicitRole
metadata for better handling of implicit ARIA roles (fe45ec4), closes #224
8.3.0 (2023-08-20)
Features
Bug Fixes
- html5:
<label>
cannot have emptyfor
(3626e1a), closes #223 - html5:
element-required-attributes
allows<button>
withouttype
(useno-implicit-button-type
instead) (d32f492), closes #221
8.2.0 (2023-08-07)
Features
- add
allowedIfParentIsPresent
metadata helper (2668899) - html5: add
<source>
attributes metadata (e3a3311) - support passing native
HTMLElement
to metadata helpers (8af6d01), closes #207
Bug Fixes
- api: typing for
Rule.setSeverity()
changed to only acceptSeverity
(64f4210)
8.1.0 (2023-07-22)
Features
Bug Fixes
- add
compatibilityCheck
function to browser bundle (b89dcc2) - api: remove unintended
null
return value from plugins api (0eb0ea8)
8.0.5 (2023-06-13)
Bug Fixes
- fix import issue with
elements/html5.js
(0604c21), closes #219 - make
elements/html5
work with esm (d95de27)
8.0.4 (2023-06-12)
Bug Fixes
- add explicit node import (73f9a1f)
8.0.3 (2023-06-12)
Bug Fixes
- fix regression bug when using
elements
in extended configuration files and plugins (6892083) - use correct dts when using custom conditions (1b6971e)
8.0.2 (2023-06-10)
Bug Fixes
- add
browser
condition for main import (d2f7a74) - remove usage of
node:path
andprocess
in browser build (2580aeb)
8.0.1 (2023-06-10)
Bug Fixes
- fix nodejs code being included in browser bundle (7c76a3b)
8.0.0 (2023-06-04)
⚠ BREAKING CHANGES
See migration guide for details.
- api: The
ConfigFactory
parameter toConfigLoader
(and its child classesStaticConfigLoader
andFileSystemConfigLoader
) has been removed. No replacement.
If you are using this you are probably better off implementing a fully custom
loader later returning a ResolvedConfig
.
- api: A new
getContextualDocumentation
replaces the now deprecatedgetRuleDocumentation
method. The context parameter togetRuleDocumentation
is now required and must not be omitted.
For rule authors this means you can now rely on the context
parameter being
set in the documentation
callback.
For IDE integration and toolchain authors this means you should migrate to use
getContextualDocumentation
as soon as possible or if you are continuing to use
getRuleDocumentation
you are now required to pass the config
and context
field from the reported message.
- api: This change affect API users only, specifically API users
directly using the
Config
class. Additionally when using theStaticConfigLoader
no modules will be resolved usingrequire(..)
by default any longer. Instructions for running in a browser is also updated, see below.
To create a Config
instance you must now pass in a Resolver
(single or
array):
+const resolvers = [ /* ... */ ];
-const config = new Config( /* ... */ );
+const config = new Config(resolvers, /* ... */ );
This applies to calls to Config.fromObject(..)
as well.
The default resolvers for StaticConfigLoader
is StaticResolver
and for
FileSystemConfigLoader
is NodeJSResolver
. Both can optionally take a new set
of resolvers (including custom ones).
Each resolver will, in order, try to load things by name. For instance, when
using the NodeJSResolver
it uses require(..)
to load new items.
NodeJSResolver
- usesrequire(..)
StaticResolver
- uses a predefined set of items.- api: The
HtmlValidate
class now has aPromise
based API where most methods return a promise. The old synchronous methods are renamed.
Either adapt to the new asynchronous API:
-const result = htmlvalidate.validateFile("my-awesome-file.html");
+const result = await htmlvalidate.validateFile("my-awesome-file.html");
or migrate to the synchronous API:
-const result = htmlvalidate.validateFile("my-awesome-file.html");
+const result = htmlvalidate.validateFileSync("my-awesome-file.html");
For unittesting with Jest it is recommended to make the entire test-case async:
-it("my awesome test", () => {
+it("my awesome test", async () => {
const htmlvalidate = new HtmlValidate();
- const report = htmlvalidate.validateString("...");
+ const report = await htmlvalidate.validateString("...");
expect(report).toMatchCodeFrame();
});
- api:
ConfigLoader
must returnResolvedConfig
. This change affects API users who implements custom configuration loaders.
In the simplest case this only requires to call Config.resolve()
:
-return config;
+return config.resolve();
A resolved configuration cannot further reference any new files to extend, plugins to load, etc.
- api: The
TemplateExtractor
class has been moved to the@html-validate/plugin-utils
package. This change only affects API users who use theTemplateExtractor
class, typically this is only used when writing plugins. - config: Deprecated severity alias
disabled
removed. If you use this in your configuration you need to update it tooff
.
{
"rules": {
- "my-awesome-rule": "disabled"
+ "my-awesome-rule": "off"
}
}
- rules: The
void
rule has been removed after being deprecated a long time, it is replaced with the separatevoid-content
,void-style
andno-self-closing
rules. - deps: minimum required node version is v16
- deps: minimum required jest version is v27
Features
- api:
ConfigLoader
must returnResolvedConfig
(d685e6a) - api:
FileSystemConfigLoader
supports passing a customfs
-like object (fac704e) - api: add
Promise
based API toHtmlValidate
class (adc7783) - api: add
Resolver
classes as a mean to separatefs
from browser build (3dc1724) - api: new
getContextualDocumentation
to replacegetRuleDocumentation
(60c9a12) - api: remove
ConfigFactory
(e309d89) - api: remove
TemplateExtractor
in favour of@html-validate/plugin-utils
(a0a512b) - deps: minimum required jest version is v27 (dc79b6b)
- deps: minimum required node version is v16 (f6ccdb0)
- rules: remove deprecated
void
rule (3e727d8)
Bug Fixes
- config: remove deprecated severity alias
disabled
(6282293)
7.18.1 (2023-06-04)
Bug Fixes
- cli: error message on missing --config file (e948a18)
7.18.0 (2023-05-24)
Features
Bug Fixes
- api: mark
Config.fromFile()
as internal (3e70028) - api: mark
Config.getMetaTable()
as internal (8cb6dd0) - api: mark
dumpEvents
,dumpSource
,dumpTokens
anddumpTree
as internal (866f219) - jest:
toMatchCodeframe
andtoMatchInlineCodeframe
handles async result (584c67e)
7.17.0 (2023-05-12)
Features
- allow to specify plugins inline in configuration (6ba1467)
Bug Fixes
- rules: allow custom elements to use
aria-label
(513a813)
7.16.0 (2023-05-04)
Features
- api:
ConfigLoader
returns aResolvedConfig
(1fd8b73)
Dependency upgrades
- deps: update dependency @html-validate/stylish to v4 (2a089ec)
7.15.3 (2023-05-03)
Bug Fixes
- api: remove unused
url
import (a2017ff)
7.15.2 (2023-05-03)
Bug Fixes
- api: fix typescript not finding type declarations (0950bb9), closes #217
- rules:
form-dup-name
defaults to allow<button type="submit">
to share name (b39b9ad), closes #212
Dependency upgrades
- deps: update dependency glob to v10 (1855cf0)
7.15.1 (2023-04-09)
Bug Fixes
- add missing exports (7fb141d)
- fix
html-validate/test-utils
entrypoint (62fbee3) - include tsdoc-metadata.json (61dd7dd)
7.15.0 (2023-04-09)
Features
- dts rollup (9743e9c)
Bug Fixes
- dom:
querySelector
typescript declaration returns null to match implementation (9c9befe) - fix browser entrypoint for older bundlers (c8320ba)
7.14.0 (2023-03-26)
Features
- rules: add
[role="alertdialog"]
as a default sectioning root forheading-level
(b87581a)
Bug Fixes
- cli: fix glob pattern when file extension list is empty (d95a418)
Dependency upgrades
- deps: update dependency glob to v9 (effd3bc)
7.13.3 (2023-03-10)
Bug Fixes
7.13.2 (2023-02-08)
Bug Fixes
- add button and reset types to form-dup-name shared options (d6ef9f8)
7.13.1 (2023-01-15)
Bug Fixes
no-unused-disable
properly reports location when more than two rules are disabled (26d1970)- allow
no-unused-disable
to be disabled by directive (b11166c)
7.13.0 (2023-01-15)
Features
- expose
Validator
helper (6ef10dd), closes #204 - report unused disable directives (5a2731f), closes #196
7.12.2 (2023-01-09)
Bug Fixes
form-dup-name
validate checkboxes by default (d5e7b7d), closes #202- add
allowArrayBrackets
option toform-dup-name
rule (a43ea0b), closes #203 - add
shared
option toform-dup-name
to set which controls allow shared names (7ddc02b), closes #201
7.12.1 (2023-01-05)
Bug Fixes
7.12.0 (2022-12-28)
Features
- api:
Attribute.valueMatches
can take array of keywords to match against (0a5ff8e) - api: add
Rule.getMetaFor(..)
(5a76381) - api: add new
formAssociated
property when defining metadata (3d56c4a) - meta:
MetaAttributeAllowedCallback
takes the attribute as second argument (7a4edeb) - rules: new rule
form-dup-name
(74f8e2d), closes #197 - rules: new rule
map-id-name
(abe5acb), closes #184
Bug Fixes
- parser: enable cache api on document root (a1cfe64)
7.11.1 (2022-12-22)
Bug Fixes
- allow setting metadata attribute to
null
to remove it (7118d9b) - better error message when element inheritance fails (717c186)
7.11.0 (2022-12-19)
Features
- api: add
keywordPatternMatcher
for usage withinclude
/exclude
options (6bd360f) - rules: add
include
andexclude
support tono-unknown-elements
(cd7fb23) - validateOccurrences and element-permitted-occurences support tag category (b37d9ac)
Bug Fixes
- hgroup is still valid, support the current content model (4040db3), closes #198
- rules: improve error message for
wcag/h63
(fa16f51) - rules: improved error message with
element-required-content
using categories (a71a2d8)
7.10.1 (2022-12-04)
Bug Fixes
- allow
as
withprefetch
(54ceeb1)
7.10.0 (2022-11-17)
Features
- rules: add
wcag/h63
for header cell scopes (ee012c6)
Bug Fixes
- html5:
<th>
does not requirescope
attribute (44bb935), closes #189 - rules:
empty-heading
handleshidden
attribute (e33b55e), closes #193 - rules:
wcag/h30
handleshidden
attribute (c5ac930)
7.9.0 (2022-11-16)
Features
- new
definePlugin
helper (e28c275) - rules: new option
ignoreCase
added tounrecognized-char-ref
(4a1b9af) - rules: new option
requireSemicolon
added tounrecognized-char-ref
(b7a5067) - rules: new rule
map-dup-name
(ad7bfff), closes #180
Bug Fixes
- rules: add selector to
unrecognized-char-ref
errors (73b29ef) - rules: include different capitalization for named character references (html entities) (83f205a), closes #192
7.8.0 (2022-10-31)
Features
- html5: bundle element metadata (1e59f3e)
Bug Fixes
- api:
getFormatter
ts declaration guarantees aFormatter
will be returned for known formatters (14ce8b1)
7.7.1 (2022-10-24)
Bug Fixes
- api: export browser bundle as
html-validate/browser
(dc1c322) - html5: handle
<meta property>
(RDFa such as OG) (63e8814), closes #187
7.7.0 (2022-10-23)
Features
- html5: validates
<a target>
and<area target>
for valid keywords (6fa0bd9) - new
defineMetadata
helper for writing custom element metadata (6a06811), closes #186 - rules: new rule
area-alt
(3c1f0b3), closes #178 - rules: new rule
attribute-misuse
(07a0bbe), closes #181
Bug Fixes
- html5:
<map>
requiresname
attribute (6104eb3) - html5:
<meta charset>
should only allowutf-8
(aaa15fe) - html5: disallow
<area coords>
whenshape
isdefault
(76115f2), closes #183 - html5: mark
<keygen>
as deprecated (859402d) - html5: require
<area coords>
whenshape
is requires is (ed750c1), closes #182
7.6.0 (2022-10-10)
Features
input-missing-label
checks for presence of text (4aa7d77), closes #170- api: add
HtmlElement.ariaLabelledby
(8463d43) - api: expose
classifyNodeText
helper (97621fd) - api: new rule helper
hasAccessibleText
(b8f8330) - rules:
classifyNodeText
helper respectshidden
andaria-hidden
attributes (8ba2c5a) - rules:
classifyNodeText
option to ignore hidden attribute on element (41ba7f9) - rules:
isHTMLHidden
andisAriaHidden
can return detailed results (fb28c2e)
Bug Fixes
<select>
does no longer classify as having text content (3fb1d15)<textarea>
does no longer classify as having text content (04517cf)- rules:
empty-heading
satisfied by images with alt text (ff68fbb), closes #176
7.5.0 (2022-09-19)
Features
7.4.1 (2022-09-11)
Bug Fixes
input-missing-label
should ignore<input type="reset">
too (280bb5c)- allow
<template>
as parent to<li>
(aa0aadc)
7.4.0 (2022-09-11)
Features
Bug Fixes
- html5:
<meta itemprop>
can be used where flow or phrasing is expected (0c6c74c), closes #168 - rename preset
html-validate:a17y
tohtml-validate:a11y
(typo fix) (0440fcd), closes #171 - rules:
input-missing-label
now ignores input typesubmit
andbutton
(39317da), closes #170 - rules: improve error message when alt is empty (8f50e8f)
- rules: verify presence of alt attribute on
<input type="image">
(feeb56e)
7.3.3 (2022-08-25)
Bug Fixes
<form>
action attribute false positives (f93a8fc), closes #167- cli: fix typo in maximum warnings message (8971323)
7.3.2 (2022-08-24)
Bug Fixes
7.3.1 (2022-08-21)
Bug Fixes
- handle quoted
.
,#
,:
and[
in attribute selectors (7282625), closes #162 #147 - html5: disallow empty
action
attribute on<form>
(0cdb7b2), closes #165
7.3.0 (2022-08-11)
Features
7.2.0 (2022-08-04)
Features
- html5: add
<dialog>
element (243bf56), closes #160 - rules:
element-permitted-content
lists all required ancestors (be34e01) - rules:
element-permitted-content
verifies root element (6eb721f) - rules: split ancestor validation from
element-permitted-content
to new ruleelement-required-ancestors
(dcb2096)
Bug Fixes
- api: allow passing object when reporting errors (f8500be)
- api: hide internal properties when using
--dump-events
(206294f) - html5:
<body>
should only accept flow content (1b08c66) - html5:
<li>
requires<ul>
,<ol>
or<menu>
parent (b88384e) - rules:
element-permitted-content
documentation fixes (613dd48)
7.1.2 (2022-07-05)
Bug Fixes
- add missing metadata for SVG
<title>
and<desc>
elements (78ec55f), closes #157 - escape additional characters in CSS selectors (774ba95), closes #158
7.1.1 (2022-05-22)
Bug Fixes
Dependency upgrades
- deps: update dependency @html-validate/stylish to v3 (23549e3)
7.1.0 (2022-05-15)
Features
- rules: add
any
option toattr-quotes
(cedf9d5), closes #152 - rules: add
include
/exclude
options torequire-sri
rule (93931c5), closes #153 - rules: new rule
require-csp-nonce
(d534a32)
Dependency upgrades
- deps: update dependency @sidvind/better-ajv-errors to v2 (bd27e3c)
7.0.0 (2022-05-06)
⚠ BREAKING CHANGES
See migration guide for details.
- require node 14
Features
- require node 14 (e294b5e)
6.11.1 (2022-05-06)
Bug Fixes
- add type declaration for
html5.js
(4647dee) - expose
MetaDataTable
type (79f30d0) - fix loading
jest.js
andtest-utils.js
(84877df)
6.11.0 (2022-05-05)
Features
- deps: support jest 28 (458e460)
Bug Fixes
- handle windows
\\
when expanding directories (dfe3dbf)
6.10.0 (2022-05-04)
Features
- jest: add
.toMatchCodeframe()
as complement to.toMatchInlineCodeframe()
(23473e4) - jest: support passing string to
toMatch{,Inline}Codeframe()
(1864e43)
Bug Fixes
- jest: extend recommended config when using
toHTMLValidate()
(5c890ea)
Performance Improvements
- improve performance by caching json schema (6be5c3a)
6.9.1 (2022-04-29)
Bug Fixes
6.9.0 (2022-04-27)
Features
- new rule
valid-id
(706000b)
Bug Fixes
6.8.0 (2022-04-24)
Features
tel-non-breaking
checks for presence ofwhite-space: nowrap
(6d1b968)- deferred generation of selectors for error messages for more accurate results (ac98c6e)
- implement
style
property onHtmlElement
(f6f8ad2) - jest: add new
toMatchInlineCodeframe
matcher (dc0eab4) - jest: remove internal
toBeToken
matcher from public consumption (15f7e1c) - migrate
html5.json
tohtml5.js
(6316b98) - require jest 25.1 or later (f4fad37)
Dependency upgrades
- deps: update dependency glob to v8 (ccb6dd4)
6.7.1 (2022-04-08)
Bug Fixes
- rules: fix reported selector for
tel-non-breaking
errors (0909ce4) - rules: show character description in
tel-non-breaking
(894d456)
6.7.0 (2022-04-08)
Features
Bug Fixes
- cli: proper argument count to
--print-config
(91c1a45) - remove unnecessary fields from published package.json (06528c7)
- rules: better error message for
attr-delimiter
(acf4249)
6.6.1 (2022-03-25)
Bug Fixes
- api: typescript declaration for
ProcessElementContext
updated (e843b8c)
6.6.0 (2022-03-20)
Features
Bug Fixes
- cli: report error when mode flags are missing filename (7e87cd4), closes #144
- disable
svg-focusable
by default (d15a503)
6.5.0 (2022-02-27)
Features
- rules: support message interpolation (9356809)
- support
--
as delimiter for comments (7c90250), closes #143 - throw error when directive is missing end bracket (4cba14b)
Bug Fixes
- dom: proper location when using
DOMTokenList
with multiple whitespace (7b2d62c)
6.4.0 (2022-02-18)
Features
- dom: add typeguards to attribute API (f831223)
- event: add parent element to
conditional
event (b248e3b)
Bug Fixes
6.3.2 (2022-02-16)
Bug Fixes
- handle reading stdin (
/dev/stdin
) on Windows (dcf65d1), closes #141 - replace
\\
in urls generated on Windows (950b3cf), closes #140
6.3.1 (2022-02-03)
Dependency upgrades
- deps: update dependency @sidvind/better-ajv-error to v1.1.1 (8aa3438)
6.3.0 (2022-02-03)
Features
- new rule
aria-hidden-body
(4f3b04f)
Bug Fixes
- global element metadata is returned for unknown elements (831f227)
- rules: improve error message for
element-required-content
(b29d908) - rules: improve error message for
empty-title
(0a62b1a)
Dependency upgrades
- deps: update dependency @sidvind/better-ajv-error to v1.1.0 (f785448)
6.2.0 (2022-01-17)
Features
- expose
isTextNode()
(502ef09)
Bug Fixes
- rules: improve error message for
attribute-allowed-values
(b3d4d11)
6.1.6 (2022-01-07)
Bug Fixes
- meta: disallow unknown element properties (aca70fc)
Dependency upgrades
- deps: drop json-merge-patch dependency (5306b2d)
6.1.5 (2021-12-28)
Bug Fixes
- config: dont process extends multiple times (f014311)
- config: elements from extended configs should be loaded first not last (d19519e)
6.1.4 (2021-12-04)
Bug Fixes
6.1.3 (2021-11-19)
Bug Fixes
- parse
<style>
content as text instead of markup (0ab61e6), closes #137 - rules: handle malformed
style
attribute inno-inline-style
rule (7e12d50)
6.1.2 (2021-11-13)
Bug Fixes
- fix .d.ts paths in package (f24c2f4)
6.1.1 (2021-11-10)
Dependency upgrades
- deps: update dependency @sidvind/better-ajv-errors to v1 (373b608)
6.1.0 (2021-10-02)
Features
- rules:
allowed-links
supportinclude
andexclude
(a3f7b6a)
Bug Fixes
6.0.2 (2021-09-27)
Bug Fixes
- jest: jest matcher should use FileSystemConfigLoader (4d04bdc)
6.0.1 (2021-09-27)
Bug Fixes
- docs (4973ee4)
6.0.0 (2021-09-26)
⚠ BREAKING CHANGES
See migration guide for details.
- htmlvalidate: This change only affects API users, the CLI tool continues to work as before.
The default configuration loader has changed from FileSystemConfigLoader
to
StaticConfigLoader
, i.e. the directory traversal looking for
.htmlvalidate.json
configuration files must now be explicitly enabled.
- event:
ConfigReadyEvent
passesResolvedConfig
instance instead ofConfigData
- meta:
MetaElement.attribute
has changed fromstring[]
toMetaAttribute[]
and bothrequiredAttributes
anddeprecatedAttributes
has been merged into object. This only affects API usage, primarily custom rules accessing attribute metadata.SeeMIGRATION.md
for details.
The old format is deprecated but is internally converted as to not break user configuration. For compatibility it will probably be around for quite a while but users should try to migrate as soon as possible.
Features
- bump required node version to 12.22 (80f3399)
- elements: migrate bundled html5 element metadata to new attribute syntax (6132b82)
- event:
ConfigReadyEvent
passesResolvedConfig
instance instead ofConfigData
(5808a6b) - htmlvalidate: use
StaticConfigLoader
by default (bb94341) - meta: add new list property to
MetaAttribute
(4c1e3c9) - meta: extend element attribute metadata (6506aa6), closes #71
Dependency upgrades
- deps: update dependency espree to v9 (3e0ea96)
4.14.1 (2021-09-18)
Bug Fixes
- jest: handle when
jest-diff
default import is object (74f9b84)
5.5.0 (2021-09-05)
Features
- dom: add iterator to
DOMTokenList
(7bef736) - rules:
no-missing-references
handles more aria attributes (2843680) - rules: add
minInitialRank
option toheading-level
(7f58572), closes #132
Bug Fixes
- jest: synchronous matchers as long as the passed value is synchronous (0ede9f7)
- rules:
no-missing-references
handles attributes with reference lists (2afcd86), closes #133
5.4.1 (2021-08-29)
Bug Fixes
5.4.0 (2021-08-27)
Features
Bug Fixes
5.3.0 (2021-08-23)
Features
- jest matchers support async results (ef7331f)
Bug Fixes
- jest: handle when
jest-diff
default import is object (7413db9)
5.2.1 (2021-08-09)
Bug Fixes
5.2.0 (2021-07-23)
Features
- support specifying a custom loader when using library (0e509a3)
- config: add
StaticConfigData
for simple static config (ae40706)
Bug Fixes
- elements: disallow whitespace in
id
(df2906b) - meta: regex matching attribute allowed values matches entire string (ffa0d12)
- rules: handle id with whitespace in
no-redundant-for
(a79f266), closes #128
5.1.1 (2021-07-11)
Bug Fixes
5.1.0 (2021-07-11)
Features
- lexer: add attribute key-value delimiter to attribute value token (0979798)
- rules: new rule
attr-delimiter
(eb98461), closes #126 - support .cjs configuration files (cd458e3)
Bug Fixes
- automatically find external dependencies (62af8c5)
- es build (6b1cec5)
- import semver correctly (4ed8eac)
- make prefer-button tag and attribute checks case-insensitive (95e7748)
- only check value of type attribute in prefer-button rule (2e46586)
5.0.2 (2021-06-28)
Bug Fixes
5.0.1 (2021-06-27)
Bug Fixes
- custom log callback for
compatibilityCheck
(cbd2226)
Dependency upgrades
- deps: update dependency @html-validate/stylish to v2 (ab0b1f9)
5.0.0 (2021-06-27)
⚠ BREAKING CHANGES
- the library is now shipped as a hybrid CJS/ESM package. If you are simply consuming the CLI tool or one of the existing integrations this will not affect you.
For plugin developers and if you consume the API in any way the biggest change is that the distributed source is now bundled and you can no longer access individual files.
Typically something like:
-import foo from "html-validate/dist/foo";
+import { foo } from "html-validate"
Feel free to open an issue if some symbol you need isn't exported.
If your usage includes checking presence of rules use the ruleExists
helper:
-try {
- require("html-validate/dist/rules/attr-case");
-} catch (err) {
- /* fallback */
-}
+import { ruleExists } from "html-validate";
+if (!ruleExists("attr-case")) {
+ /* fallback */
+}
- drop support for NodeJS 10
Features
- add
compatibilityCheck
helper for plugins (4758595) - cjs/esm hybrid package (39c960a), closes #112
- drop support for NodeJS 10 (8f74291)
Dependency upgrades
- deps: update dependency ajv to v8 (cccb73a)
4.14.0 (2021-06-14)
Features
4.13.1 (2021-05-28)
Bug Fixes
- jest: fix
TypeError: diff is not a function
(2afc2e8)
4.13.0 (2021-05-28)
Features
- jest: better compatibility with jest in node environment (79d14ca)
Dependency upgrades
- deps: support jest v27 (863f73d)
- deps: update dependency @sidvind/better-ajv-errors to ^0.9.0 (8f6d162)
4.12.0 (2021-05-17)
Features
- rules: enforce initial heading-level in sectioning roots (c4306ad)
4.11.0 (2021-05-08)
Features
dom:ready
anddom:load
containssource
reference (430ec7c), closes #115- add
:scope
pseudoselector (6e3d837), closes #114 - add
isSameNode()
(7d99007) - add new event
source:ready
(4c1d115), closes #115 - rules:
deprecated
takesinclude
andexclude
options (e00d7c1)
Bug Fixes
- dom: throw if
tagName
is invalid (42d7100)
4.10.1 (2021-04-25)
Bug Fixes
- handle directives with excessive whitespace (0400563)
4.10.0 (2021-04-18)
Features
- dom: implement {first,last}ElementChild accessors (5e70aee)
- formatters:
stylish
andcodeframe
displays links to error descriptions (86cf213), closes #113 - formatters: checkstyle output is indented (e284fb7)
- parser: add full location to
attr
event (key, quotes, value) (931a39f) - rules: add rule url to
Message
(6845fac) - rules: new option
allowedProperties
tono-inline-style
(defaults todisplay
) (75aa5f0)
Bug Fixes
- rules: rule documentation url for rules in subdirectories (c91c36d)
4.9.0 (2021-04-04)
Features
Bug Fixes
- config: validate preset configurations (dca9fc3)
- error: present original json for configuration errors (23a50f3)
- meta: memory leak when loading meta table (940ca4e), closes #106
4.8.0 (2021-03-28)
Features
4.7.1 (2021-03-19)
Bug Fixes
- add
$schema
tohtml5.json
(9a89d30)
4.1.1 (2021-03-19)
Bug Fixes
$schema
keyword being invalid (3b67062)
4.7.0 (2021-03-14)
Features
Bug Fixes
- dom:
input[type="hidden"]
no longer labelable (244d37d)
4.6.1 (2021-03-02)
Bug Fixes
- dom:
generateSelector()
escapes characters (c2e316c), closes #108 - dom:
querySelector
handles escaped characters (30e7503) - dom: throw error when selector is missing pseudoclass name (516ca06)
4.6.0 (2021-02-13)
Features
- parser: add DOCTYPE tag to
DoctypeEvent
(8c53d40) - parser: new event
token
emitted for each lexer token (f9d44d6) - rules: allow rules to unregister event listeners (8b1a6bc)
- rules: new rule
attr-spacing
requiring attributes to be separated by whitespace (7734dc6), closes #105 - rules: new rule
doctype-style
requiring doctype to be specific case (e94f819) - rules: new rule
no-utf8-bom
disallowing usage of UTF-8 BOM (7a2d264)
Bug Fixes
- lexer: handle CRLF after xml declaration (97fd77d)
- lexer: handle doctype with mixed case (a40e28e)
- lexer: handle html comment before doctype (6c1b830)
- lexer: handle unicode bom (97506b1)
4.5.0 (2021-02-05)
Features
- meta:
transparent
can be limited to specific elements (bef8a16)
Bug Fixes
4.4.0 (2021-01-31)
Features
- events: new event
tag:ready
emitted when start tag is parsed (cfbf3dc) - events: rename
tag:open
andtag:close
totag:start
andtag:end
(7a2150f) - rules:
heading-level
supports sectioning roots (8149cc6), closes #92
Bug Fixes
- rules: better error message for
heading-level
(0871706)
Dependency upgrades
- deps: update dependency @sidvind/better-ajv-errors to ^0.8.0 (f317223)
4.3.0 (2021-01-19)
Features
- rules: new rule
text-content
(2fef395), closes #101 - transform: new helper
processElement
for writing tests (3052f81) - add
browser
entry point without cli classes (7840ec2) - set
sideEffects
tofalse
(41b47f8)
Bug Fixes
- dom:
DOMTokenList
(such asclasslist
) handles newlines and tabs (35e601e)
4.2.0 (2021-01-15)
Features
- dom: disable cache until node is fully constructed (5e35c49)
- htmlvalidate: add
getConfigurationSchema()
to get effective configuration schema (1dd81d9) - htmlvalidate: add
getElementsSchema()
to get effective elements schema (4baac36), closes #78 - rule: support filter callback for rule events (f3f949c)
- rules: add
allowMultipleH1
option toheading-level
(a33071d)
Bug Fixes
- enable
strictNullCheck
(64b5af2), closes #76 - event:
location
property can benull
for some events (fbbc87c) - event: pass
null
when attribute value is missing (08c2876) - rules: rule options uses
Partial<T>
(221113b)
Dependency upgrades
- deps: update dependency ajv to v7 (4c04388)
4.1.0 (2020-12-14)
Features
- replace
inquirer
withprompts
(82d17eb)
4.0.2 (2020-11-19)
Bug Fixes
- deps: replace dependency on
eslint
with@html-validate/stylish
(2d1bc81)
4.0.1 (2020-11-09)
Bug Fixes
- rules:
wcag/h32
checks fortype="image"
(4a43819) - rules:
wcag/h32
handles submit buttons usingform
attribute to associate (cb2e843)
4.0.0 (2020-11-07)
⚠ BREAKING CHANGES
- config: With this release any custom configuration files will no longer
automatically extend
html-validate:recommended
.
The previous behaviour was to to always merge with the default configuration
containing extends: ["html-validate:recommended"]
. This is counter-intuitive
when adding a blank {}
.htmlvalidate.json
configuration file (or a file with
extends: []
). The new behaviour is to not apply default configuration if
another configuration is found.
To retain the previous behaviour you must ensure your configuration contains
extends: ["html-validate:recommended"]
. Users who have root: true
are not
affected. If unsure: test your configuration by deliberatly introducing and
error and verify it is detected.
For CLI users: ensure your .htmlvalidate.json
configuration files are updated.
For IDE integration users: ensure your .htmlvalidate.json
configuration files
are updated.
For CLI
API users: same as with CLI the configuration loading has changed and
all users must update their .htmlvalidate.json
accordingly.
For HtmlValidate
API users: you are most likely not affected, only if both of
the following conditions are true you need to take care to ensure any
.htmlvalidate.json
is updated:
- you are using
validateFile
or supply filenames to other validation functions. - you allow user-supplied configurations (or use them yourself) via
.htmlvalidate.json
(default unlessroot: true
is set in the configuration object passed tonew HtmlValidate(..)
)
The ConfigLoader
API has also been updated and fromTarget
may now return
null
if no configuration file was found.
- The
build
folder has been renamed todist
.
This affects API users only and in general should not be an issue unless
importing files via full path. In that case replace import 'html-validate/build/...'
with import 'html-validate/dist/...
but in general
those imports are discouraged.
Instead users should import only via import { ... } from "html-validate"
and file an issue
if an export is missing.
This does not affect the elements
imports which is considered a safe to import
as-is.
- Only node 10 or later is supported
Features
- new utility function
ruleExists
to test presence of bundled rules (09aad04) - rules: new helper
isHTMLHidden
(ae20335) - shim: add new export
html-validate/test-utils
exposing test-utils (30f5d40) - shim: expose all event structures in shim (294bb0d)
- shim: expose metadata structures (271e521)
Bug Fixes
- config: dont automatically apply
extends: ["html-validate:recommended"]
(fcad0b2), closes #98 - require node 10 (d1a48b1)
- rules:
input-missing-label
handles multiple labels (a6af2da) - rules:
input-missing-label
ignores hidden<input>
(41c39e9) - rules:
input-missing-label
requires label to be non-hidden (ff5e855), closes #99
Miscellaneous Chores
- migrate to
dist
folder (3c6787c)
3.5.0 (2020-10-18)
Features
- rules: new rule
no-multiple-main
(fa3c065)
3.4.1 (2020-10-13)
Bug Fixes
3.4.0 (2020-10-08)
Bug Fixes
- deps: update dependency acorn-walk to v8 (5a41662)
- rules: fix issue in
no-dup-id
where value is dynamic (203debe), closes #96
Features
- api: add additional prototypes to
validateString
(69e8102) - dom: new api for caching data on
DOMNode
(13d99e4) - rules: implement caching in some helper methods (5746d6c)
3.3.0 (2020-09-08)
Bug Fixes
- jest: add missing
filename
to typescript declaration (4be48fa) - meta: default to pass when testing excluded category from unknown element (07afa1a)
- rules: handle unknown elements better in
element-permitted-content
(58ba1aa), closes #95
Features
- jest:
toHTMLValidate()
supports passing expected errors (7b3c30e)
3.2.0 (2020-08-26)
Features
- rules: new rule allowed-links (d876206)
3.1.0 (2020-08-20)
Bug Fixes
- rules:
no-redundant-for
should only target<label>
(a2395b6)
Features
- meta: new property
labelable
(bf5cd6e) - rules: new rule
multiple-labeled-controls
(ee28774), closes #86 - rules: new rule
no-redundant-for
(d4445bb), closes #87
3.0.0 (2020-06-21)
Bug Fixes
- deps: update dependency chalk to v4 (614da1b)
- deps: update dependency eslint to v7 (186be9b)
- deps: update dependency espree to v7 (863cd0f)
chore
- drop node 8 support (b0a6731)
BREAKING CHANGES
- Node 8 support has been removed.
2.23.1 (2020-06-21)
Bug Fixes
2.23.0 (2020-05-18)
Bug Fixes
- cli:
expandFiles
path normalization for windows (b902853)
Features
- config: add two new config presets
html-validate:standard
andhtml-validate:a17y
(36bf9ec), closes #90 - rules: add
include
andexclude
options toprefer-button
(b046dc5), closes #90 - rules: add
isKeywordExtended
method for rule authors (ca7e835)
2.22.0 (2020-05-15)
Bug Fixes
- elements: add
<details>
and<summary>
elements (47ba673), closes #89 <legend>
should allow heading elements (73e150f)- deps: update dependency json-merge-patch to v1 (e9f83d2)
Features
2.21.0 (2020-04-26)
Bug Fixes
- meta: throw schema validation error when element metadata does not validate (6ecf050), closes #81
- schema: allow
permittedContent
andpermittedDescendants
to use AND-syntax (2fa742c), closes #82 - transform: expose
computeOffset
(d033538)
Features
- dom:
DOMTokenList
can extract location data for each token (4f4dfe0), closes #74 - rules: add
include
andexclude
options tono-inline-style
(6604e88), closes html-validate/html-validate-angular#3 - rules: use more precise location from
DOMTokenList
(e874784)
2.20.1 (2020-04-19)
Bug Fixes
- handle loading js-files via
extends
again (e29987f)
2.20.0 (2020-04-05)
Bug Fixes
- meta: add missing null return type to MetaTable.getMetaFor (44eac5b)
- allow loading elements from js-file again (5569a94)
- make
ast
property private (cb1a2c8)
Features
- support loading custom formatters (0b02a31)
- formatters: use factory to load formatters to make it more webpack-friendly (81bef6e)
2.19.0 (2020-03-24)
Bug Fixes
Features
- meta: implicit inheritance when overriding existing element (8833a0f)
2.18.1 (2020-03-22)
Bug Fixes
- meta: allow regexp literal in element schema (444a472), closes #70
- meta: make all meta properties optional in type declaration (eac5052)
- meta: support case-insensitive regexp flag (96e7343), closes #69
- rules: use original wcag rule names (1d5aa3c)
Reverts
- Revert "ci: temporary add debug to troubleshoot @semantic-release/gitlab" (b4d016b)
2.18.0 (2020-03-11)
Bug Fixes
- validate
input[list]
(9c70db2) - rules:
no-dup-id
handles when id is set but omitted value (5f678a5) - rules:
no-missing-references
ignores omitted references (b8863cd) - rules: add contextual documentation for
deprecated
(7fbf433) - rules: add contextual documentation for
element-name
(2a98bad) - rules: better and more contextual messages for
deprecated
(3602be7) - rules: contextual documentation for
deprecated-rule
(8b10601) - rules: improve documentation for
doctype-html
(1a896a8) - shim: expose
ConfigError
andUserError
(2d002c7) - transform: ignore non-string values in
TemplateExtractor
(7f27c8b) - allow both null and empty string when attribute allows empty values (5b6991b)
Features
2.17.1 (2020-03-02)
Bug Fixes
- disable
void-style
when usingtoHTMLValidate
matcher (4d6bb3d)
2.17.0 (2020-02-17)
Bug Fixes
- elements:
<img>
srcset
attribute cannot be empty (27699ad) - jest: typescript compatibility with jest@23 (4efae54)
- rules: add
aria-label
helper (6d5d963) - rules: fix
deprecated-rule
missing location (1156c1e) - change config merge order in
toHTMLValidate
(204a8fa) - rules: handle
aria-label
on links for WCAG H30 (eb01542), closes #67
Features
- rules: mark
void
as deprecated (f6afc0f), closes #58 - rules: new rule
no-self-closing
(d9c869b), closes #58 - rules: new rule
script-element
(48ad6da) - rules: new rule
script-type
(a680f1d) - rules: new rule
void-content
(c93c63b), closes #58 - rules: new rule
void-style
(f30de03), closes #58 - allow configuration override when using
validate{String,Source}
(6e62852)
2.16.0 (2020-02-12)
Bug Fixes
- cli: fix typo when using
--init
with vuejs (6eee478) - dom:
querySelector
and friends return empty when selector is empty (6a871de) - schema: add title and description to most properties (a7cea78)
- schema: handle
$schema
in config and elements (a4f9054) - add missing
jest.js
andjest.d.ts
(8b767c2)
Features
- add import
html-validate/jest
as a shortcut to the jest matchers (4ccf6ed) - expose
NodeClosed
,TextNode
,Plugin
andParser
(f344527)
2.15.0 (2020-02-09)
Features
- plugin: load
default
transformer if loading named transformer without name (efb0eb9)
2.14.0 (2020-02-06)
Features
- elements: make
<legend>
in<fieldset>
optional (covered by new h71 rule instead) (f3a59b9) - rules: new method
getTagsDerivedFrom
to get tag and tags inheriting from it (0118738) - rules: new rule
wcag/h71
requiring<fieldset>
to have<legend>
(1b8ceab)
2.13.0 (2020-02-02)
Features
- meta: allow plugins to add copyable metadata (242eaa8)
2.12.0 (2020-01-27)
Bug Fixes
Features
2.11.0 (2020-01-26)
Bug Fixes
Features
- dom: add
generateSelector
(12e718e) - dom: new type
DOMInternalID
(ada3cd3) - dom: support pseudo-classes
:first-child
,:last-child
and:nth-child
(af39ea1) - rules: add selector to reported errors (6b6ae3d)
- rules: improved reported error location for some rules (216b449)
- shim: expose
Report
(6091050)
2.10.0 (2020-01-22)
Features
2.9.0 (2020-01-17)
Features
2.8.2 (2020-01-09)
Bug Fixes
- create directory only if missing (5db6fe8)
2.8.1 (2020-01-06)
Bug Fixes
- cli: create output directory as needed (b5569f3)
- meta: load metadata with
readFile
instead ofrequire
(c5de95b)
2.8.0 (2020-01-02)
Features
- rule: validate matching case for start and end tags (288cf86)
- rules: refactor
parseStyle
fromelement-case
andattr-case
(24d8fad) - rules: support multiple case styles (5a397bd), closes #50
- rules: support pascalcase and camelcase for
element-case
rule (be7d692)
2.7.0 (2019-12-16)
Bug Fixes
- config: more helpful error when user forgot to load plugin (62bbbe5)
Features
- config: configuration schema validation (c9fe45f), closes #61
- dom: allow plugins to modify element annotation (979da57)
- dom: allow plugins to modify element metadata (cbe3e78), closes #62
- elements: make schema publicly accessible (bcab9e4)
- rules: use annotated name (1895ef4)
2.6.0 (2019-12-12)
Bug Fixes
- cli: useful error message when metadata is invalid (165da72)
- elements: allow
requiredAttributes
and others to be empty array (244d038), closes #59 - error: better schema validation error (9a5f8fe)
Features
- lexer: handle rudimentary template tags such as
<% .. %>
(a0f6190)
2.5.0 (2019-12-09)
Bug Fixes
- config: keep track of plugin original name (9e7ea3e)
- config: throw error is plugin is missing (bc61a6b)
- htmlvalidate: more verbose output from
--dump-source
(f0089c6) - htmlvalidate: prefer html-validate:recommended (8deb03a)
Features
- htmlvalidate: new method
canValidate
to test if a file can be validated (f523028)
2.4.3 (2019-12-08)
Bug Fixes
- parser: report parser-error when stream ends before required token (50e1d67)
2.4.2 (2019-12-05)
Bug Fixes
2.4.1 (2019-12-02)
Bug Fixes
- lexer: handle missing
Source
properties (likeoffset
) (2092942)
2.4.0 (2019-12-01)
Bug Fixes
- config:
init
can now safely be called multiple times (ed46c19) - htmlvalidate: initialize global config if needed (6d05747)
Features
- htmlvalidate: retain
offset
when yielding multiple sources (fe1705e) - transform: add
offsetToLineColumn
helper (1e61d00)
2.3.0 (2019-11-27)
Bug Fixes
- config: update
--init
config for html-validate-vue@2 (6553ded)
Features
- transform: support
hasChain
to test if a transformer is present (e8ef4f5)
2.2.0 (2019-11-23)
Bug Fixes
- config: throw ConfigError when elements cannot be loaded (62c08e7)
- docs: update plugin docs (340d0ca)
- plugin: make all fields optional (a587239)
Features
- plugin: allow specifying name (6554f72)
2.1.0 (2019-11-21)
Bug Fixes
- deps: update dependency chalk to v3 (f84bd35)
- rules: wcag/h32 support custom form elements (e00e1ed)
Features
- meta: add method to query all tags with given property (eb3c593)
- meta: adding
form
property (edf05b0) - meta: allow inheritance (5c7725d)
- meta: support @form category (66d75a8)
2.0.1 (2019-11-19)
Bug Fixes
- config: better error when loading missing transformer from plugin (db48a01)
- config: fix loading non-plugin transformer with plugin present (c9ad080), closes #54
2.0.0 (2019-11-17)
Features
- config: transformers must now operate on
Source
(9c2112c) - config: wrap transformer error message better (9f833e9)
- htmlvalidate: string sources are now transformed too (0645e37)
- plugin: support exposing transformers from plugins (1370565)
- transform: add context object as
this
(cb76cb3) - transform: add version number to API (94a5663)
- transform: adding test utils (9e42590)
- transform: support chaining transformers (4a6fd51)
- transform: support returning iterators (623b2f2)
BREAKING CHANGES
- config: Previously transformers took a filename and had to read data of
the file itself. Transformers will now receive a
Source
instance with the data preread.
1.16.0 (2019-11-09)
Bug Fixes
- cli: fix
--init
not creating configuration unless overwriting (9098529) - config: use
readFile
to prevent unintended caching (4864bfa)
Features
- shim: expose version number in shim (890d122)
1.15.0 (2019-11-03)
Bug Fixes
- cli:
--help
does not take an argument (e22293f)
Features
- cli: add
--dump-source
to debug transformers (4d32a0d) - cli: add
--init
to create initial configuration (6852d30)
1.14.1 (2019-10-27)
Bug Fixes
1.14.0 (2019-10-20)
Features
- shim: expose more types (86bb78d)
- enable typescript strict mode (excect strict null) (5d2b45e)
- htmlvalidate: support passing filename to
validateString
(c2e09a2)
1.13.0 (2019-10-13)
Features
- rules: support deprecating rules (de80d96)
1.12.0 (2019-10-08)
Features
- cli: new API to get validator instance (6f4be7d)
- cli: support passing options to CLI class (aa544d6)
- config: add
root
property to stop searching file system (9040ed5) - shim: expose HtmlElement in shim (dbb673f)
1.11.0 (2019-09-23)
Bug Fixes
- config: expand
<rootDir>
in elements (eeddf4c)
Features
- meta: new property
scriptSupporting
(c271a04)
1.10.0 (2019-09-19)
Features
1.9.1 (2019-09-19)
Bug Fixes
1.9.0 (2019-09-17)
Features
- rules: new rule
svg-focusable
(c354364)
1.8.0 (2019-09-16)
Bug Fixes
- rules: fix prefer-button crashing on boolean type attribute (94ce2a8)
Features
- cli: allow specifying extensions (2bdd75f)
- cli: cli learned
--version
to print version number (95c6737) - cli: exit early when encountering unknown cli arguments (1381c51)
- cli: expose expandFiles function (edab9cf)
- cli: handle passing directories (f152a12)
- cli: support setting cwd when calling expandFiles (420dc88)
- event: new event config:ready (c2990b5)
1.7.1 (2019-09-15)
Bug Fixes
- config: better error message when transformer fails to load (c5a4f38)
1.7.0 (2019-09-11)
Bug Fixes
- parser: fix conditional comments pushing elements into tree (b26fe80), closes #51
- rules: attr-case no longer reports duplicate errors for dynamic attributes (c06ae67), closes #48
Features
- location: allow sliceLocation to wrap line/column (cbd7796)
- rules: add PascalCase and camelCase styles for
attr-case
(9e91f81), closes #49
1.6.0 (2019-09-01)
Bug Fixes
- matchers: typo in error message (daeabba)
Features
- matchers: optionally test context (44fcf47)
1.5.1 (2019-08-20)
Bug Fixes
- elements: mark contextmenu attribute as deprecated (db4069f)
Features
- rules: new rule no-unknown-elements (96f5fcf)
1.5.0 (2019-08-17)
Bug Fixes
- elements:
<img>
must have non-empty src (8916e19) - rules: change output format of wcag/h37 and element-required-attributes to match (26f5074)
Features
- cli: add --config to specify a custom configuration file (87b565f)
- elements:
<fieldset>
requires<legend>
(0bce9dd) - elements:
<head>
requires<title>
(8aaa801) - elements: src, href, etc attributes cannot be empty (89c7ac6)
- parser: include valueLocation in doctype event (803ddae)
- rules: new rule doctype-html (46061a7)
- rules: new rule element-required-content (664dead)
- rules: new rule no-style-tag (a1dff5c)
1.4.0 (2019-08-15)
Bug Fixes
- deps: update dependency acorn-walk to v7 (1fe89e0)
- reporter: fix {error,warning}Count after merging reports (bc657d0)
- reporter: require {error,warning}Count to be present in Result (b1306a4)
Features
- cli: add new --max-warnings flag (e78a1dc)
- reporter: add {error,warning}Count summary to Report object (2bae1d0)
1.3.0 (2019-08-12)
Features
- rules: new rule no-missing-references (4653384)
1.2.1 (2019-07-30)
- fix configuration when using multiple extends.
1.2.0 (2019-06-23)
- new rule
prefer-tbody
to validate presence of<tbody>
in<table
. - add
requiredAncestors
metadata and validation to test elements with additional requirements for the parent elements, such as<area>
and<dd>
/<dt>
. - add
HtmlElement.closest()
to locate a parent matching the given selector. - add
HtmlElement.matches()
to test if a selector matches the given element. - fix so multiple combinators can be used in selectors, e.g.
foo > bar > baz
now works as expected.
1.1.2 (2019-06-18)
- allow div to group elements under dl (fixes #44).
1.1.1 (2019-06-07)
Reporter
is now exposed in shim.getFormatter
CLI API now returns output as string instead of writing directly to stdout.codeframe
formatter now adds final newline in output.
1.1.0 (2019-06-04)
input-missing-label
now validates<textarea>
and<select>
.querySelector
and friends now handles[attr="keyword-with-dashes"]
and similar constructs.
1.0.0 (2019-05-12)
- rule
wcag/h37
now ignores images withrole="presentation
oraria-hidden="true"
. - allow
crossorigin
attribute to be boolean or""
(maps to"anonymous"
). - add
<picture>
element. - mark
<style>
as foreign as to not trigger errors inside css content. - allow whitespace around attribute equals sign, e.g
class = "foo"
.
0.25.1 (2019-05-10)
- allow raw ampersands (
&
) in quoted attributes. - extend set of allowed characters in unquoted attributes in lexer.
0.25.0 (2019-04-23)
- new rule
unrecognized-char-ref
for validating character references. - add support for
auto
style forattr-quotes
rule. - new rule
no-raw-characters
to check for presence of unescaped<
,>
and&
characters.
0.24.2 (2019-03-31)
Features
- new rule
meta-refresh
. - new event
element:ready
triggered after an element and its children has been fully constructed. - add plugin callbacks
init()
andsetup()
. - new rule
require-sri
. - add
<slot>
element.
0.24.1 (2019-03-26)
Bugfixes
- fix broken edit links in footer.
- fix broken import causing typescript API users getting build errors.
0.24.0 (2019-03-26)
Features
- adding link to edit documentation and view rule source in documentation.
- new rule
wcag/h36
. - new rule
wcag/h30
. - new rule
long-title
. - new rule
empty-title
. - add
UserError
exception which is to be used for any error which is not caused by an internal error, e.g. configuration errors or a plugin. The error suppresses the notice about internal error which should be reported as a bug. - reworked and extendable validation of elements metadata. Plugins may now add support for custom metadata.
Bugfixes
- fix handling of plugins with no rules.
0.23.0 (2019-03-20)
Features
- new rule
empty-heading
validating headers have textual content. - let plugins add configuration presets.
- add
processElement
hook onSource
. - add
textContent
property onDOMNode
to get text (recursive) from child nodes. A new node typeTextNode
is added. - add
firstChild
andlastChild
toDOMNode
. - docs: precompile syntax highlighting for smoother page loads.
- expose
Config
,ConfigData
andConfigLoader
in shim.
0.22.1 (2019-02-25)
Breaking change
.children
has been split and moved fromHtmlElement
toDOMNode
..childNodes
replaces the original.children
but is now typedDOMNode[]
(and in a future release may contain other node types). A getter.nodeElements
can be used to access onlyHtmlElement
from.childNodes
and is typedHtmlElement[]
. If your rules use.children
the
Bugfixes
<rootDir>
is now respected when configuring plugins.- fix cosmetic case of
wcag/h37
rule.
0.22.0 (2019-02-24)
Breaking changes
HtmlElement
direct access toattr
is replaced withattributes
. The former was an key-value object and the latter is a flattened array ofAttribute
.
Features
- exposes
Source
andAttributeData
in shim. HtmlElement
will now store duplicated (or aliased) attributes. The biggest change this introduces is thatclassList
will now contain a merged list of all classes. This is needed when combining a staticclass
attribute with a dynamic one.- DOM
Attribute
got two flagsisStatic
andisDynamic
to easily tell if the value is static or dynamic. - more verbose exception when a transformer fails. (fixes #37)
- allow
processAttribute
hook to yield multiple attributes, typically used when adding aliased attributes such as:class
. By adding both the alias and the original the latter can be validated as well (e.g.no-dup-attr
can trigger for multiple uses of:class
). (fixes #36) - allow setting hooks when using
HtmlValidate.validateString
, makes it easier to write tests which requires hooks, e.g. processing attributes.
Bugfixes
[attr]
selector now matches boolean attributes.attribute-boolean-style
andno-dup-attr
now handles when dynamic attributes is used to alias other attributes, e.g:required="foo"
no longer triggers an boolean style andclass=".."
combined with:class=".."
no longer triggers duplicate attributes. (fixes #35)attribute-allowed-values
now ignores boolean attributes with dynamic values. (partially fixes #35)
0.21.0 (2019-02-17)
Breaking changes
button-type
is replaced withelement-required-attributes
.
Features
- new rule
element-required-attributes
replacesbutton-type
and allows any element to containrequiredAttributes
metadata. - support foreign elements. The body of the foreign element will be discarded from the DOM tree and not trigger any rules.
- CLI write a more verbose message when unhandled exceptions are raised.
--dump-events
output reduced by hiding element metadata and compacting location data.- use jest snapshots to test element metadata as it is more maintainable.
Bugfixes
- allow
<area shape="default">
(fixes #31)
0.20.1 (2019-02-06)
Bugfixes
- fix #33: ensure
wcag/h37
andwcag/h67
checks if node exists before testing tagname. - handle boolean attributes in
attribute-allowed-values
.
0.20.0 (2019-01-29)
Features
- update
codeframe
formatter to show not just start location but also end.
Bugfixes
- Fixes html-validate-angular#1 by handling both regular and arrow functions.
0.19.0 (2019-01-27)
Breaking changes
img-req-alt
has been renamedwcag/h37
.
Features
- new rule
prefer-button
. Attribute
now stores location of value.- new rules
wcag/h32
andwcag/h67
. - move
location
andisRootElement
toDOMNode
and add newnodeType
property. - add
Attribute.valueMatches
to test attribute value. HandlesDynamicValue
. querySelector
now handles selector lists (comma-separated selectors)
0.18.2 (2019-01-14)
Bugfixes
- fix issue when calling
getAttributeValue
on a boolean attribute. - handle
DynamicValue
inDOMTokenList
andid-pattern
.
0.18.1 (2019-01-12)
Features
- CLI learned
--print-config
to output configuration for a given file.
0.18.0 (2019-01-10)
Features
- add support for dynamic attribute values, that is the value is marked as being
set but has no known value. Rules are expected to assume the value exists and
is valid. The primary usage for this is in combination with the
parseAttribute
hook, e.g:id="..."
can yield attributeid
with a dynamic value. - add support for transformer hooks, currently the only hook is
parseAttribute
allowing the transformer to alter the attribute before any events are emitted, e.g. it can pick up the vuejs:id
attribute and pass it asid
to allow other rules to continue just as ifid
was typed.
Bugfixes
- fix
ConfigLoader
tests when running on windows.
0.17.0 (2019-01-09)
Breaking changes
DOMNode
has been renamedHtmlElement
and there is instead a new base classDOMnode
whichHtmlElement
extends from. Rules usingDOMNode
need to be changed to useHtmlElement
.
Features
- use Prettier for formatting sources.
- add
HtmlValidate.getRuleDocumentation()
API for IDEs to fetch contextual rule documentation. - add
codeframe
formatter (from eslint). - add
HtmlValidate.flushConfigCache
to allow flushing the config loader cache. - add
TemplateExtractor.createSource
as a quick way to create a source from filename. - add typescript definition for
shim.js
- add
validateSource
toHtmlValidate
allowing to manually passing a source. HtmlValidate.getConfigFor
is now part of public API.
Bugfixes
- Directives can now enable/disable rules working with
dom:ready
event. HtmlElement
location is now shifted by 1.
0.16.1 (2018-12-16)
Bugfixes
Message
now passessize
property fromLocation
0.16.0 (2018-12-15)
Features
Location
has a new propertysize
holding the number of characters the location refers to.HtmlValidate
class now loads same default config as CLI if no configuration is passed explicitly.Location
has a new propertyoffset
holding the offset into the source data (starting at zero).- CLI learned
--stdin
and--stdin-filename
for passing markup on standard input and explicitly naming it. Useful for external tools and IDEs which wants to pass the markup in stdin instead of a temporary file.
0.15.3 (2018-12-05)
Features
- expose
querySelector
andquerySelectorAll
onDOMNode
, not justDOMTree
.
0.15.2 (2018-12-01)
Features
- move repository to https://gitlab.com/html-validate/html-validate
- move homepage to https://html-validate.org
- more element attributes added.
0.15.1 (2018-11-26)
Features
- new properties
previousSibling
andnextSibling
onDOMNode
.
0.15.0 (2018-11-21)
Features
- new rule
attribute-boolean-style
to validate style of boolean attributes. - new property
nodeName
onDOMNode
.
Bugfixes
attribute-allowed-values
now normalizes boolean attributes before validating, i.e. it will acceptdisabled
,disabled=""
ordisabled="disabled"
. Fixes #13.input
learnedrequired
attribute.querySelector
properly handles attribute selectors with dashes and digits. Fixes #15.
0.14.2 (2018-11-06)
Features
- bump dependencies.
- use
acorn-walk
instead ofacorn@5
.
0.14.1 (2018-11-04)
Bugfixes
- fix dependency on
acorn
, the package now properly resolves acorn 5 when dependant pulls acorn 6.
0.14.0 (2018-11-03)
- support global metadata.
- new rule
attribute-allowed-values
validates allowed values for attributes, such astype
for<input>
.
0.13.0 (2018-10-21)
Features
deprecated
supports adding a message for custom elements.- Rule constructors can now throw exceptions. Previously the exceptions would be silently swallowed and the rule would trigger the missing rule logic.
- Support writing element metadata inline in configuration file.
Bugfixes
element-permitted-order
now reports the error where the malplaced element is instead of the parent element (which holds the restriction). Fixes #10.
0.12.0 (2018-10-17)
Features
- Support writing plugins with custom rules.
- Bump dependencies, including typescript 3.0 to 3.1
0.11.1 (2018-10-07)
Features
- Rule documentation examples are now validated automatically with htmlvalidate to provide direct feedback of how a rule will react on the given markup.
Bugfixes
no-implicit-close
now provides more context when closed by a sibling.close-order
no longer reports error for implicitly closed elements.
0.11.0 (2018-09-23)
Breaking changes
- For compatibility with other tools the severity
disable
has been renamed tooff
. The old name will continue to work but will be removed in the future.
Features
- support directives to enable/disable rules inside files, e.g. to ignore a single error.
- rules are now using dynamic severity which can change at runtime.
- new class
Attribute
used byDOMNode
. Attributes now holds the location they are created from making DOM attribute rules more precise. - new rule
heading-level
for validating sequential heading levels.
Bugfixes
element-permitted-occurrences
no longer triggers for the first occurrence, only subsequent usages.Table.getMetaFor(..)
is not case-insensitive.
0.10.0 (2018-08-11)
Breaking changes
- rule api overhaul, all rules are now classes.
Features
- support multiple events for single listener and listener deregistration.
- new
Engine
class for easier programmatical usage. - stricter types related to events
- bump dependencies.
Bugfixes
- add espree dependency
0.9.2 (2018-07-12)
Features
- add
no-inline-style
tohtmlvalidate:recommended
. - add
htmlvalidate:document
for predefined set of document-related rules, e.g. recommended for documents but not component templates. - add
missing-doctype
rule to require doctype. - add source location to root DOMNode containing the first line and column in the source file.
- add
doctype
property toDOMTree
. - add
doctype
event, emitted when a doctype is encountered. - add
element-case
rule for validating case of element names. - add
attr-case
rule for validating case of attributes.
0.9.1 (2018-07-01)
Features
- add
protractor-html-validate
to docs.
0.9.0 (2018-06-17)
Breaking changes
- semantics for
require
changed fromrequire('html-validate')
torequire('html-validate').HtmlValidate
to support exposing other classes.
Features
- new
TemplateExtractor
helper class for extracting templates from javascript sources. - trigger downstream projects on release
Bugfixes
- Report
valid
now only checks for errors, the result will still be valid if only warnings are present.
0.8.3 (2018-06-12)
- run tests against multiple node versions (8.x, 9.x and 10.x) to ensure compatibility.
- exposed
getFormatter
as a reusable function to load formatters from string (like CLI tool):name[=DST][,name=DST...]
0.8.2 (2018-05-28)
Bugfixes
- lexer better handling of newlines, especially CRLF
\r\n
.
0.8.1 (2018-05-27)
Misc
- update
package.json
0.8.0 (2018-05-27)
Features
- easier API usage:
require('html-validate')
now returns class without usingrequire(html-validate/build/htmlvalidate').default
. - support
transform
in configuration to extract source html from other files. - attach
depth
andunique
read-only properties toDOMNode
corresponding to the nodes depth in the DOM tree and a sequential id (unique for the session). - new rule
no-conditional-comments
to disallow usage of conditional comments. - handle conditional comments.
Bugfixes
- handle whitespace before doctype
- DOMTokenlist now handles multiple spaces as delimiter and strip leading/trailing whitespace.
0.7.0 (2017-11-04)
Features
- new rule
no-implicit-close
to disallow usage of optional end tags. - handle optional end tags.
- better result sorting, error messages are now sorted by line and column, the stage which triggered the error doesn't matter any longer.
- better result merging, files will no longer be duplicated.
- element metadata can no be sourced from multiple sources and be configured
using the
elements
configuration property.
Improvements
- better configuration merging
Bugfixes
- fixed script tag incorrectly consuming markup due to greedy matching.
0.6.0 (2017-10-29)
Features
- new rule
no-deprecated-attr
for testing if any deprecated attributes is used. - CLI supports globbing (as fallback if shell doesn't expand the glob already)
Bugfixes
- fix lowercase
<!doctype html>
crashing the lexer. - fix node binary name in shebang
- fix directory traversal on windows
0.5.0 (2017-10-17)
Features
- Rule
element-name
learnedwhitelist
andblacklist
options. - Support outputting to multiple formatters and capturing output to file.
- checkstyle formatter. Use
-f checkstyle
.
0.4.0 (2017-10-17)
Features
- new rule
no-inline-style
disallowing inlinestyle
attribute. - new rule
img-req-alt
validating that images have alternative text. - new rule
element-permitted-order
validating the required order of elements with restrictions. - new rule
element-permitted-occurrences
validating elements with content models limiting the number of times child elements can be used.
Bugfixes
- the parser now resets the DOM tree before starting, fixes issue when running the same parser instance on multiple sources.
0.3.0 (2017-10-12)
Features
- new rules
id-pattern
andclass-pattern
for requiring a specific formats. - new rule
no-dup-class
preventing duplicate classes names on the same element.
Bugfixes
- lexer now chokes on
<ANY\n<ANY></ANY></ANY>
(first tag missing>
) instead of handling the inner<ANY>
as an attribute. element-permitted-content
fixed issue where descending with missing metadata would report as disallowed content.
0.2.0 (2017-10-11)
Features
- Support putting configuration in
.htmlvalidate.json
file. void
rule rewritten to better handle both tag omission and self-closing. It learned a new optionstyle
to allow a single style.- new rule
element-permitted-content
verifies that only allowed content is used. - new rule
element-name
to validate custom element names.
0.1.3 (2017-10-08)
Features
- Rule documentation
Bugfixes
no-dup-attr
now handles attribute names with different case.