Skip to main content

no-stray-head-or-body-tag

Content the HTML Living Standard doesn't permit in <head> (e.g. <math>) implicitly closes head and reprocesses the offending token in <body>. That closure is not itself a parse error, but if the source still contains a literal </head> tag afterward, or a second <body> start tag, those tokens now arrive too late:

❌ Examples of incorrect code for this rule

<head>
<title>math in head</title>
<math><mi>x</mi></math>
</head>
<body></body>

✅ Examples of correct code for this rule

<head>
<title>ordinary head content</title>
</head>
<body>
<math><mi>x</mi></math>
</body>

Interface

{
"no-stray-head-or-body-tag": boolean
}

VALUE_DESCRIPTION

Options

{
"no-stray-head-or-body-tag": {
"options": {
"__OPTIONS_PROP_NAME__"?: boolean
}
}
}
PropertyTypeDefault ValueDescription
__OPTIONS_PROP_NAME__boolean"true"OPTIONS_PROP_DESCRIPTION

Default Severity

error