Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • H html-validate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • html-validate
  • html-validate
  • Issues
  • #51
Closed
Open
Created Sep 08, 2019 by Matt (IPv4)@MattIPv4

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