illegal attr - bhsd-harry/wikiparser-node GitHub Wiki

illegal-attr

❌ By default, this rule reports illegal attributes of extension tags and HTML tags as errors.

Examples

Examples of correct code for { "illegal-attr": 2 }:

<poem data-foo="foo" />
<div itemscope itemtype="https://schema.org/Product"></div>
<div tabindex="0"></div>
<ol type="1"></ol>
<br xmlns:foo="1">
<link itemprop="url" href="https://example.com">

Options

tabindex

This option can be configured to specify the severity of an non-zero tabindex.

Examples of incorrect code for { "illegal-attr": [ 0, { "tabindex": 2 } ] }:

<br tabindex="1">

Examples of correct code for { "illegal-attr": [ 2, { "tabindex": 0 } ] }:

<br tabindex="1">

unknown

This option can be configured to specify the severity of unknown attribute names.

Examples of incorrect code for { "illegal-attr": [ 0, { "unknown": 2 } ] }:

<ref id="foo">Bar</ref>
<br accesskey="b">
<br foo="bar">
<poem data-mw="foo" />
<meta itemprop="name" content="foo" class="bar">
<div itemtype="https://schema.org/Product"></div>

Examples of correct code for { "illegal-attr": [ 2, { "unknown": 0 } ] }:

<ref id="foo">Bar</ref>
<br accesskey="b">
<br foo="bar">
<poem data-mw="foo" />
<meta itemprop="name" content="foo" class="bar">
<div itemtype="https://schema.org/Product"></div>

value

This option can be configured to specify the severity of invalid attribute values.

Examples of incorrect code for { "illegal-attr": [ 0, { "value": 2 } ] }:

<ol type="foo"></ol>
<br xmlns:foo="javascript:alert(1)">
<link itemprop="url" href="foo">

Examples of correct code for { "illegal-attr": [ 2, { "value": 0 } ] }:

<ol type="foo"></ol>
<br xmlns:foo="javascript:alert(1)">
<link itemprop="url" href="foo">
⚠️ **GitHub.com Fallback** ⚠️