Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • 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
  • #58
Closed
Open
Created Dec 12, 2019 by David Sveningsson@extsidvindOwner

Split void into multiple separate rules

Currently the rule void does multiple validations:

  • void-elements must not have content (e.g. <input>, <hr>, etc)
  • void-elements must be closed using the configured style: omit <input> or self-closing <input/>.
  • non-void-elements must always have a close tag.

This is fine as long as the defaults are ok but is not very flexible to configure.

Suggesting to split this into three separate rules:

  • void-element ensures that an element with "void": true cannot have any content. Test this by ensuring that there are no children at al (no elements, text nodes, etc).
    Default: error
  • void-style ensures the correct style when "void": true
    Default: error, style: omit
  • no-self-closing ensures that elements "void": false isn't self-closed.
    Default: error

Use cases

  • Allow user to configure that empty tags (no content) may be self-closing tag but close tag if content is present, e.g both <my-foo/> and <my-foo>bar</my-foo> should be valid under this configuration:
    "no-self-closing": false

Acceptance tests

Default config void-element void-style omit void-style self-closing no-self-closing
<input> error
<input/> error error
<input></input> error error
<input>foo</input> error error
<div/> error error
Edited Jan 06, 2020 by David Sveningsson
Assignee
Assign to
Time tracking