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 23
    • Issues 23
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 8
    • Merge requests 8
  • 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
  • #60
Closed
Open
Created Dec 12, 2019 by David Sveningsson@extsidvindOwner

Support adding/removing from element metadata array

When extending existing element it is sometimes desirable to just add or remove an item from an array.

Consider the following <my-component> component wrapping an <input> element and dynamically binding all attributes from the component:

<input type="text" :attrs="attrs">

Suitable element metadata would be:

{
  "my-component": {
    "inherit": "input"
  }
}

Since <input> requires type to be set ("requiredAttributes": ["type"]) usage of <my-component> would yield errors despite the underlying <input> element having the type attribute.

Setting requiredAttributes to an empty array would reset the attribute but possibly remove other unwanted attributes from the array. It would be useful to have a method of removing elements from the array without resetting it.

Suggested solution

Support setting requiredAttributes to ["-type"] to remove type when merging the array without removing other entries. Similarly a + could be used to add entries. This would have issues with non-string types and if the item has an actual leading + or -, i.e. consider an attribute such as tabindex="-1".

Perhaps the array could be specified with an object structure similar to:

"requiredAttributes": {
  "add": ["foo"],
  "remove": ["bar"]
}
Edited Aug 29, 2021 by David Sveningsson
Assignee
Assign to
Time tracking