Supported HTML features
User guide
- Getting Started
Api
Concepts
Configurations
Configuring webhint
Connectors
Development flow integration
Extensions
Formatters
Hints
- Avoid CSS limits
- Avoid HTTP redirects
- axe accessibility check
- Babel configuration hint set
- Compatibility of CSS, HTML and JavaScript features
- Correct `Content-Type` header
- Correct manifest extension
- Correct viewport
- Detect CSS Reflows
- Disallowed HTTP headers
- External links disown opener
- Has web app manifest
- Highest document mode
- HTTP cache
- Leading '.' in `classList.add` or `classList.remove`
- Manifest has name
- Minify JavaScript
- Modern DOCTYPE
- No `createElement` with SVG
- No `P3P` headers
- No broken links
- No byte-order mark
- No Inline CSS Styles
- No protocol-relative URLs
- No small error pages
- No vulnerable libraries
- Nu HTML test
- Optimal compression
- Optimize images
- Performance budget
- Prefixed CSS first
- scoped-svg-styles
- Specify button type
- SSL server test
- TypeScript configuration hints set
- Unneeded HTTP headers
- Use `Strict-Transport-Security` header
- Use `X-Content-Type-Options` header
- Use Apple touch icon
- Use charset `utf-8`
- Use HTTPS
- Use subresource integrity
- Valid `Set-Cookie` header
- Valid `theme-color`
- Valid manifest
- webpack configuration hints set
Parsers
Server configurations
Troubleshoot
- Api
- Concepts
- Configurations
- Configuring webhint
- Connectors
- Development flow integration
- Extensions
- Formatters
- Hints
- Parsers
- Server configurations
- Troubleshoot
Supported HTML features (compat-api/html
)
What does the hint check?
compat-api/html
checks if the HTML elements and attributes used are
supported in all target browsers.
Why is this important?
New HTML elements and attributes are being implemented all the time. It’s tricky knowing when an element or attribute has become standard among all browsers. This hint will check if you are using elements or attributes that are not supported by your target browsers.
Examples that trigger the hint
The blink element was never added to any version of Chrome. Targeting Chrome browsers of any version will trigger the hint.
<blink>Why would somebody use this?</blink> |
The srcset
attribute of the img element was never
added to any version of Internet Explorer. Targeting
Internet Explorer browsers of any version will trigger the hint.
<img srcset="foo.jpg, bar.jpg"> |
The input type color
was not added for any
version of Internet Explorer. Targeting any version of Internet Explorer
will trigger the hint for this input type.
<input type="color"> |
Examples that pass the hint
The div element has been added for all versions of all browsers. It will pass the hint regardless of whatever your target browsers are.
<div></div> |
The alt
attribute of the img element has been added for all versions
of all browsers. It will pass the hint regardless of whatever your target
browsers are.
<img alt="mountains"> |
The video element and its autoplay
attribute was added for versions
of Internet Explorer 9 and onwards. Versions of Internet Explorer from version
9 onwards will pass the hint.
<video autoplay></video> |
Can the hint be configured?
This hint throws errors for HTML elements that are not supported in any of the target browsers listed.
The target browsers can be defined in either the .hintrc
or
package.json
file.
This property follows the same convention as browserslist.
{
"browserslist": [
"> 1%",
"last 2 versions"
]
} |
ignore
can be used to specify a list of HTML features to be ignored. The
default value is:
[
"a[rel=noopener]",
"autocomplete",
"crossorigin",
"input[inputmode]",
"integrity",
"link[rel]",
"main",
"spellcheck"
] |
In the .hintrc
file:
{
"connector": {...},
"formatters": [...],
"hints": {
"compat-api/html": ["error", {
"ignore": ["blink"],
}],
...
},
...
} |
enable
can be used to specify a list of HTML features to be checked even if
they are included in the ignore list. The default value is []
.
In the .hintrc
file:
{
"connector": {...},
"formatters": [...],
"hints": {
"compat-api/html": ["error", {
"enable": ["integrity"],
}],
...
},
...
} |
Limitations
HTML features not represented in MDN will pass to avoid false-positives. These could result from data missing for a particular browser or because a bogus element was used.