Non-Boolean Attribute Without Value

ID

html.attr_value_not_empty

Severity

low

Remediation Complexity

low

Remediation Risk

low

Remediation Effort

low

Resource

Reliability

Language

Html

Tags

reliability

Description

Flags a non-boolean attribute written bare, that is with no =value.

Rationale

Boolean attributes such as disabled, required and checked are legitimately written bare because their mere presence carries the meaning. Any other attribute written without a value, for example <a href> or <input title>, is almost always a typo where the value was dropped; the attribute then has an empty string value and silently does nothing useful. data- attributes are exempt because a bare data- flag is a common idiom.

<a href>link</a>               <!-- FLAW — href has no value -->

<a href="/home">link</a>       <!-- OK — href has a value -->

Remediation

Give the attribute the value it needs, or remove it if it serves no purpose. Leave only true boolean attributes bare.