isValidCustomElementName
import { isValidCustomElementName } from "jsr:@ende/html/unstable-is-valid-custom-element-name";function ยท experimental
function isValidCustomElementName(elementName: string): booleanReturns whether the given string is a valid custom element name, as per the requirements defined in https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name.
elementName: stringThe element name to be validate
Returns
true if the element name is valid, false otherwise.
Example: Usage
Using a valid custom element name
import { isValidCustomElementName } from "@ende/html/unstable-is-valid-custom-element-name";
import { assertEquals } from "@ende/assert";
assertEquals(isValidCustomElementName("custom-element"), true);
assertEquals(isValidCustomElementName("font-face"), false);
assertEquals(isValidCustomElementName("custom-element@"), false);