56e214b26db36d31ca9b24e18213c8b5e4b564ba50f26ce15846e93f0758dbbf1fa061deb7a0fcfb817451e5bf22d997c503dcc43867dd7f1058af15899737 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. const tags = [
  2. "a",
  3. "abbr",
  4. "address",
  5. "area",
  6. "article",
  7. "aside",
  8. "audio",
  9. "b",
  10. "base",
  11. "bdi",
  12. "bdo",
  13. "blockquote",
  14. "body",
  15. "br",
  16. "button",
  17. "canvas",
  18. "caption",
  19. "cite",
  20. "code",
  21. "col",
  22. "colgroup",
  23. "data",
  24. "datalist",
  25. "dd",
  26. "del",
  27. "details",
  28. "dfn",
  29. "dialog",
  30. "div",
  31. "dl",
  32. "dt",
  33. "em",
  34. "embed",
  35. "fieldset",
  36. "figcaption",
  37. "figure",
  38. "footer",
  39. "form",
  40. "h1",
  41. "h2",
  42. "h3",
  43. "h4",
  44. "h5",
  45. "h6",
  46. "head",
  47. "header",
  48. "hgroup",
  49. "hr",
  50. "html",
  51. "i",
  52. "iframe",
  53. "img",
  54. "input",
  55. "ins",
  56. "kbd",
  57. "label",
  58. "legend",
  59. "li",
  60. "link",
  61. "main",
  62. "map",
  63. "mark",
  64. "math",
  65. "menu",
  66. "menuitem",
  67. "meta",
  68. "meter",
  69. "nav",
  70. "noscript",
  71. "object",
  72. "ol",
  73. "optgroup",
  74. "option",
  75. "output",
  76. "p",
  77. "param",
  78. "picture",
  79. "pre",
  80. "progress",
  81. "q",
  82. "rb",
  83. "rp",
  84. "rt",
  85. "rtc",
  86. "ruby",
  87. "s",
  88. "samp",
  89. "script",
  90. "section",
  91. "select",
  92. "slot",
  93. "small",
  94. "source",
  95. "span",
  96. "strong",
  97. "style",
  98. "sub",
  99. "summary",
  100. "sup",
  101. "svg",
  102. "table",
  103. "tbody",
  104. "td",
  105. "template",
  106. "textarea",
  107. "tfoot",
  108. "th",
  109. "thead",
  110. "time",
  111. "title",
  112. "tr",
  113. "track",
  114. "u",
  115. "ul",
  116. "var",
  117. "video",
  118. "wbr"
  119. ];
  120. function isHtmlTag(name) {
  121. return tags.includes(name);
  122. }
  123. function isTransition(name) {
  124. return ["transition-group", "TransitionGroup"].includes(name);
  125. }
  126. function isHtmlAttribute(value) {
  127. return (
  128. ["id", "class", "role", "style"].includes(value) ||
  129. value.startsWith("data-") ||
  130. value.startsWith("aria-") ||
  131. value.startsWith("on")
  132. );
  133. }
  134. export { isHtmlTag, isHtmlAttribute, isTransition };