Skip to content

form-action-whitespace

Added in 0.2.9 · Related issues · View source

Fix is always available.

What it does

Checks for leading or trailing whitespace in the action attribute of <form> elements.

Why is this bad?

The URL parser strips leading and trailing ASCII whitespace when resolving an HTML URL attribute, so the spaces are inert at runtime and only add noise to the source. They are commonly an accidental artefact of inserting a template tag inside the quotes.

Example

<form action=" /submit/ "></form>

Use instead:

<form action="/submit/"></form>

References