Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • html-validate
  • html-validate
  • Issues
  • #51

Conditional comments around elements don't work

If you use conditional comments around an element, it isn't tracked correctly in the linter.

Reduced test-case

<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<title>whatever</title>
</head>
<body>
<p>whatever</p>
</body>
</html>

Configuration

{
  "extends": [
    "htmlvalidate:recommended"
  ],

  "rules": {
    "no-inline-style": "off",
    "void": ["error", {"style": "selfclose"}],
    "no-deprecated-attr": "off",
    "no-conditional-comment": "off"
  }
}

Expected result

I would expect element-required-content & element-permitted-content to not error.

Actual result

error  <html> element must have <body> as content                                    element-required-content
error  <html> element must have <head> as content                                    element-required-content
error  <html> element must have <body> as content                                    element-required-content
error  <html> element must have <head> as content                                    element-required-content
error  Element <html> is not permitted as content in <html>                          element-permitted-content
error  Element <html> is not permitted as content in <html>                          element-permitted-content

Version

  • html-validate: 1.6.0
Assignee
Assign to
Time tracking