You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
597 B
27 lines
597 B
"use strict";
|
|
|
|
const RESTRICTED_CUSTOM_ELEMENT_NAME = new Set([
|
|
"annotation-xml",
|
|
"color-profile",
|
|
"font-face",
|
|
"font-face-src",
|
|
"font-face-uri",
|
|
"font-face-format",
|
|
"font-face-name",
|
|
"missing-glyph"
|
|
]);
|
|
|
|
const CUSTOM_ELEMENT_NAME_REGEXP = /^[a-z][-.0-9_a-z]*-[-.0-9_a-z]*$/;
|
|
|
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
|
function isValidCustomElementName(name) {
|
|
if (RESTRICTED_CUSTOM_ELEMENT_NAME.has(name)) {
|
|
return false;
|
|
}
|
|
|
|
return CUSTOM_ELEMENT_NAME_REGEXP.test(name);
|
|
}
|
|
|
|
module.exports = {
|
|
isValidCustomElementName
|
|
};
|
|
|