Skip to content

Forward slashes in regex attribute enum throws error

Reduced test-case

<my-element attr="/a"></my-element>

Configuration

"my-element": {
  "flow": true,
  "phrasing": false,
  "attributes": {
    "attr": {
      "required": false,
      "enum": ["/\\/a/"]
    }
  }
}

Expected result

attr attribute on my-element to be correctly matched to the regex //a (I'm trying to restrict the file paths on a custom element)

Actual result

my-element as the error: Attribute "attr" has invalid value "/a" (I've tried unescaping the / in the regex; same result)

Version

  • html-validate: 8.16.0

Thanks