Skip to content

Add attribute to existing tag #77

@hasn-prevas

Description

@hasn-prevas

Is it possible to add a new attribute to an existing HTML tag?

I have tried the following:

{
  "$schema": "https://json.schemastore.org/web-types",
  "name": "Foo attribute",
  "version": "0.0.1",
  "contributions": {
    "html": {
      "elements": [
        {
          "name": "Foo attribute on script tag",
          "extension": true,
          "pattern": {
            "or": ["script"]
          },
          "attributes": [
            {
              "name": "foo",
              "value": {
                "required": false
              }
            }
          ]
        }
      ]
    }
  }
}

foo attribute are now allowed on script tags, but existing attributes (e.g. defer, src etc.) are now marked as errors (in IntelliJ IDEA 2023.3.1 - Build #IU-233.11799.300):

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions