1 | 'use strict';
|
2 |
|
3 | const htmlTags = require('html-tags');
|
4 | const keywordSets = require('../reference/keywordSets');
|
5 | const mathMLTags = require('mathml-tag-names');
|
6 | const svgTags = require('svg-tags');
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | module.exports = function (selector) {
|
15 | if (!/^[a-z]/.test(selector)) {
|
16 | return false;
|
17 | }
|
18 |
|
19 | if (!selector.includes('-')) {
|
20 | return false;
|
21 | }
|
22 |
|
23 | const selectorLowerCase = selector.toLowerCase();
|
24 |
|
25 | if (selectorLowerCase !== selector) {
|
26 | return false;
|
27 | }
|
28 |
|
29 | if (svgTags.includes(selectorLowerCase)) {
|
30 | return false;
|
31 | }
|
32 |
|
33 | if (htmlTags.includes(selectorLowerCase)) {
|
34 | return false;
|
35 | }
|
36 |
|
37 | if (keywordSets.nonStandardHtmlTags.has(selectorLowerCase)) {
|
38 | return false;
|
39 | }
|
40 |
|
41 | if (mathMLTags.includes(selectorLowerCase)) {
|
42 | return false;
|
43 | }
|
44 |
|
45 | return true;
|
46 | };
|