eslint-plugin-lit-a11y
Version:
linting plugin for lit-a11y
12 lines (9 loc) • 344 B
JavaScript
const CE_TAGNAME_RE = /^[a-z]\w*-\w+/;
/**
* Is the element a custom element (i.e. does it contain a '-')?
* @param {import('parse5-htmlparser2-tree-adapter').Element} element
*/
function isCustomElement(element) {
return !!(element && typeof element.name === 'string' && CE_TAGNAME_RE.test(element.name));
}
export { isCustomElement };