This site uses cookies for analytics. By continuing to browse this site, you agree to this use.
A JS Foundation Project

Deprecated HTML features

Deprecated HTML features (compat-api/html)

What does the hint check?

compat-api/html checks if the HTML elements and attributes used are deprecated in the targeted browsers.

Why is this important?

Deprecated HTML elements and attributes should not be used as browsers may no longer provide support for them. It can be tricky knowing when browser support for HTML elements and attributes have been removed. This hint will check if you are using HTML elements and attributes that have been deprecated.

Examples that trigger the hint

The blink element is deprecated and was removed in Firefox 22. Targeting Firefox browsers of versions 22 and up will trigger the hint.

<blink>Why would somebody use this?</blink>

The scoped attribute of the style element is deprecated and was removed in Firefox 55. Targeting Firefox versions 55 and up will trigger the hint.

<style scoped>
    h1 {color:red;}
</style>

The global attribute contextmenu was removed from Firefox 56 for Android. Targeting Firefox for Android browsers of versions 56 and up will trigger the hint.

<body contextmenu="share"></body>

Examples that pass the hint

The div element was never removed by any browser. It should always pass the hint.

<div></div>

The method attribute of the form element was never removed for any browser. It should always pass the hint.

<form method="get"></form>

The global attribute class was never removed for any browser. It should always pass the hint.

<div class="foobar"></div>
<p class="foobar"></p>

Can the hint be configured?

This hint throws errors for HTML elements that have been deprecated in any of the targeted browsers listed.

The targeted 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 ['integrity'].

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"],
        }],
        ...
    },
    ...
}

Further Reading