Fixes req-webp-in-picture
to not check <picture>
if all <source>
have attribute type="image/svg+xml"
.
- Adds a
req-tags-presence
rule that requires the specified tags on the page. - Adds a
req-preload-font
rule that requires thepreload
value for the font. - Adds a
req-webp-in-picture
rule that requireswebp
in<picture>
- Adds a
no-class-in-container
rule that checks theclass
attribute for child elements inside the specified container.
{
"htmlacademy/req-tags-presence": [ true, ["header", "nav", "main", "section", "h1", "footer"]],
"htmlacademy/req-preload-font": true,
"htmlacademy/req-webp-in-picture": true,
"htmlacademy/no-class-in-container": [true, {
"containers": ["content"],
"ignore": {
"tags": ["h1", "p"],
"classes": ["content__title"]
}
}]
}
Adds a tag-forbid-attr
rule that disallows the use of specified attributes on the specified tag.
{
"tag-forbid-attr": [
true,
{
"picture": [
{
"name": "class"
}
],
"body": [
{
"name": "class"
}
]
}
]
}
Fixes report
in the req-source-width-height
Added a new rule htmlacademy/req-source-width-height that requires the width
and height
attributes of <source>
, inside <picture>
.
{
"htmlacademy/req-source-width-height": true
}
<picture>
<source srcset="images/image-tablet.jpg" width="768" height="480" media="(min-width: 768px)">
<img src="images/image-mobile.jpg" width="320" height="148" alt="">
</picture>
Clarifies the no-blocking-script rule for the <script>
tag. You can now add modules to <head>
.
<html lang="ru">
<head>
<script src="app.js" type="module"></script>
</head>
<body>…</body>
</html>
Added a new rule htmlacademy/req-mailto, which requires mailto:
for email-text links.
{
"htmlacademy/req-mailto": true
}
<a href="mailto:example@example.com">example@example.com</a>
Added a new rule htmlacademy/req-stylesheet-link that checks for a link tag with the rel="stylesheet"
attribute inside the head tag.
{
"htmlacademy/req-stylesheet-link": true
}
<head>
<link rel="stylesheet" href="styles/style.css">
</head>
- Excludes the
<input type="submit">
check from the input-req-label rule. - Adds
ignore
option for tag-req-attr
"input": [
{
name: "name",
ignore: {
"type": "submit"
}
},
],
will not require a name attribute for <input
> with type="submit"
Fix htmlacademy/attr-req-value
rule
A single <option>
in <select>
may have an empty value for the value
attribute if it is selected by default.
The following pattern is not considered a problem:
<label for="fruits">Fruits</label>
<select id="fruits" name="fruits" required>
<option value="">Select...</option>
<option value="banana">Banana</option>
<option value="apple">Apple</option>
</select>
Added htmlacademy/space-between-comments
rules: {
"htmlacademy/space-between-comments": [true, "space" | "no-space]
}
<!-- Comment --> // space
<!--Comment--> // no-space
attr-req-value
can now accept regex for ignore
Fixed req-charset-utf
rule
- Refines the list of interactive elements for aria-label-misuse
- Adds
<label>
- Adds
Added so many new rules:
- htmlacademy/aria-label-misuse
- attr-delimiter
- attribute-allowed-values
- ban-url-spaces
- id-no-dup
- input-req-label
- link-req-content
- no-blocking-script
- no-px-size
- req-head-styles
- req-meta-viewport
- req-single-styles
- tag-name-lowercase
- tag-self-close
Adds new rule htmlacademy/attr-req-value
: the attribute cannot be empty, except for the list from ignore
{
"htmlacademy/attr-req-value": [true, { ignore: ["alt"]}]
}
<button class="foo"></button>
<button disabled></button>
<img src="images/image.jpg" width="100" height="100" alt="">
Adds new rule htmlacademy/section-has-heading
<section>
<h2>title</h2>
</section>
<section>
<div>
<h2>title</h2>
</div>
</section>
Fixed name for head-meta-charset
- Rename
head-req-charset-utf
toreq-charset-utf
- Rename
head-req-meta
tohead-meta-charset
- Adds a description of the rules
- Adds
htmlacademy/charset-position
<head>
<meta charset="utf-8">
<title>Title</title>
</head>
- Adds
form-action-attribute
<form action="https://echo.htmlacademy.ru"></form>
- Adds
img-svg-req-dimensions
<img src="images/image.jpg" width="500" height="300" alt="">
<svg width="200" height="100" viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0"></rect>
</svg>
- Adds
no-double-br
<p>Lorem ipsum <br>dolor <br>sit amet.</p>
<p>Lorem ipsum <br>dolor sit amet.</p>
<p><br>sit amet.</p>
- Adds
a-target-rel
<a href="https://htmlacademy.pro" target="_blank" rel="noreferrer noopener">Link</a>
- removes
attr-value-style
; - takes the rules to the components.
Three rules were added:
- Class attribute location;
- Charset;
- Attribute value style.
Init rules