{"record":{"id":"e1a1dfb979d656d2","repo":"typst/typst","slug":"custom-element-name-must-not-contain-uppercase-let","errorCode":null,"errorMessage":"custom element name must not contain uppercase letters","messagePattern":"custom element name must not contain uppercase letters","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/typst-html/src/dom.rs","lineNumber":289,"sourceCode":"        }\n\n        // If we encounter a hyphen, we are dealing with a custom element rather\n        // than a standard HTML element.\n        //\n        // A valid custom element name must:\n        // - Contain at least one hyphen (U+002D)\n        // - Start with an ASCII lowercase letter (a-z)\n        // - Not contain any ASCII uppercase letters (A-Z)\n        // - Not be one of the reserved names\n        // - Only contain valid characters (ASCII alphanumeric and hyphens)\n        //\n        // See https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n        if has_hyphen {\n            if !string.starts_with(|c: char| c.is_ascii_lowercase()) {\n                bail!(\"custom element name must start with a lowercase letter\");\n            }\n            if has_uppercase {\n                bail!(\"custom element name must not contain uppercase letters\");\n            }\n\n            // These names are used in SVG and MathML. Since `html.elem` only\n            // supports creation of _HTML_ elements, they are forbidden.\n            if matches!(\n                string,\n                \"annotation-xml\"\n                    | \"color-profile\"\n                    | \"font-face\"\n                    | \"font-face-src\"\n                    | \"font-face-uri\"\n                    | \"font-face-format\"\n                    | \"font-face-name\"\n                    | \"missing-glyph\"\n            ) {\n                bail!(\"name is reserved and not valid for a custom element\");\n            }\n        }","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/typst/typst/blob/35417aa769ab9d699a60384f91082b09bc6ba421/crates/typst-html/src/dom.rs#L271-L307","documentation":"Guard in HtmlAttr::intern/element interning: when a candidate custom element name (one containing a hyphen) contains an ASCII uppercase letter, it is rejected because the WHATWG custom-elements spec only permits lowercase names; such a name would create an invalid custom element.","triggerScenarios":"Thrown at crates/typst-html/src/dom.rs:289 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rewrite the element name using only lowercase letters, digits, and hyphens (e.g. \"my-widget\" instead of \"myWidget\")","If camelCase is desired, convert to kebab-case before passing the name to html.elem"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35417aa769ab9d699a60384f91082b09bc6ba421","analyzedAt":"2026-08-17T21:03:48.984Z","contentChangedAt":"2026-08-17T21:03:48.984Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}