html.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. import {caseInsensitiveTransform} from './util/case-insensitive-transform.js'
  2. import {create} from './util/create.js'
  3. import {
  4. booleanish,
  5. boolean,
  6. commaSeparated,
  7. number,
  8. overloadedBoolean,
  9. spaceSeparated
  10. } from './util/types.js'
  11. export const html = create({
  12. attributes: {
  13. acceptcharset: 'accept-charset',
  14. classname: 'class',
  15. htmlfor: 'for',
  16. httpequiv: 'http-equiv'
  17. },
  18. mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],
  19. properties: {
  20. // Standard Properties.
  21. abbr: null,
  22. accept: commaSeparated,
  23. acceptCharset: spaceSeparated,
  24. accessKey: spaceSeparated,
  25. action: null,
  26. allow: null,
  27. allowFullScreen: boolean,
  28. allowPaymentRequest: boolean,
  29. allowUserMedia: boolean,
  30. alt: null,
  31. as: null,
  32. async: boolean,
  33. autoCapitalize: null,
  34. autoComplete: spaceSeparated,
  35. autoFocus: boolean,
  36. autoPlay: boolean,
  37. blocking: spaceSeparated,
  38. capture: null,
  39. charSet: null,
  40. checked: boolean,
  41. cite: null,
  42. className: spaceSeparated,
  43. cols: number,
  44. colSpan: null,
  45. content: null,
  46. contentEditable: booleanish,
  47. controls: boolean,
  48. controlsList: spaceSeparated,
  49. coords: number | commaSeparated,
  50. crossOrigin: null,
  51. data: null,
  52. dateTime: null,
  53. decoding: null,
  54. default: boolean,
  55. defer: boolean,
  56. dir: null,
  57. dirName: null,
  58. disabled: boolean,
  59. download: overloadedBoolean,
  60. draggable: booleanish,
  61. encType: null,
  62. enterKeyHint: null,
  63. fetchPriority: null,
  64. form: null,
  65. formAction: null,
  66. formEncType: null,
  67. formMethod: null,
  68. formNoValidate: boolean,
  69. formTarget: null,
  70. headers: spaceSeparated,
  71. height: number,
  72. hidden: overloadedBoolean,
  73. high: number,
  74. href: null,
  75. hrefLang: null,
  76. htmlFor: spaceSeparated,
  77. httpEquiv: spaceSeparated,
  78. id: null,
  79. imageSizes: null,
  80. imageSrcSet: null,
  81. inert: boolean,
  82. inputMode: null,
  83. integrity: null,
  84. is: null,
  85. isMap: boolean,
  86. itemId: null,
  87. itemProp: spaceSeparated,
  88. itemRef: spaceSeparated,
  89. itemScope: boolean,
  90. itemType: spaceSeparated,
  91. kind: null,
  92. label: null,
  93. lang: null,
  94. language: null,
  95. list: null,
  96. loading: null,
  97. loop: boolean,
  98. low: number,
  99. manifest: null,
  100. max: null,
  101. maxLength: number,
  102. media: null,
  103. method: null,
  104. min: null,
  105. minLength: number,
  106. multiple: boolean,
  107. muted: boolean,
  108. name: null,
  109. nonce: null,
  110. noModule: boolean,
  111. noValidate: boolean,
  112. onAbort: null,
  113. onAfterPrint: null,
  114. onAuxClick: null,
  115. onBeforeMatch: null,
  116. onBeforePrint: null,
  117. onBeforeToggle: null,
  118. onBeforeUnload: null,
  119. onBlur: null,
  120. onCancel: null,
  121. onCanPlay: null,
  122. onCanPlayThrough: null,
  123. onChange: null,
  124. onClick: null,
  125. onClose: null,
  126. onContextLost: null,
  127. onContextMenu: null,
  128. onContextRestored: null,
  129. onCopy: null,
  130. onCueChange: null,
  131. onCut: null,
  132. onDblClick: null,
  133. onDrag: null,
  134. onDragEnd: null,
  135. onDragEnter: null,
  136. onDragExit: null,
  137. onDragLeave: null,
  138. onDragOver: null,
  139. onDragStart: null,
  140. onDrop: null,
  141. onDurationChange: null,
  142. onEmptied: null,
  143. onEnded: null,
  144. onError: null,
  145. onFocus: null,
  146. onFormData: null,
  147. onHashChange: null,
  148. onInput: null,
  149. onInvalid: null,
  150. onKeyDown: null,
  151. onKeyPress: null,
  152. onKeyUp: null,
  153. onLanguageChange: null,
  154. onLoad: null,
  155. onLoadedData: null,
  156. onLoadedMetadata: null,
  157. onLoadEnd: null,
  158. onLoadStart: null,
  159. onMessage: null,
  160. onMessageError: null,
  161. onMouseDown: null,
  162. onMouseEnter: null,
  163. onMouseLeave: null,
  164. onMouseMove: null,
  165. onMouseOut: null,
  166. onMouseOver: null,
  167. onMouseUp: null,
  168. onOffline: null,
  169. onOnline: null,
  170. onPageHide: null,
  171. onPageShow: null,
  172. onPaste: null,
  173. onPause: null,
  174. onPlay: null,
  175. onPlaying: null,
  176. onPopState: null,
  177. onProgress: null,
  178. onRateChange: null,
  179. onRejectionHandled: null,
  180. onReset: null,
  181. onResize: null,
  182. onScroll: null,
  183. onScrollEnd: null,
  184. onSecurityPolicyViolation: null,
  185. onSeeked: null,
  186. onSeeking: null,
  187. onSelect: null,
  188. onSlotChange: null,
  189. onStalled: null,
  190. onStorage: null,
  191. onSubmit: null,
  192. onSuspend: null,
  193. onTimeUpdate: null,
  194. onToggle: null,
  195. onUnhandledRejection: null,
  196. onUnload: null,
  197. onVolumeChange: null,
  198. onWaiting: null,
  199. onWheel: null,
  200. open: boolean,
  201. optimum: number,
  202. pattern: null,
  203. ping: spaceSeparated,
  204. placeholder: null,
  205. playsInline: boolean,
  206. popover: null,
  207. popoverTarget: null,
  208. popoverTargetAction: null,
  209. poster: null,
  210. preload: null,
  211. readOnly: boolean,
  212. referrerPolicy: null,
  213. rel: spaceSeparated,
  214. required: boolean,
  215. reversed: boolean,
  216. rows: number,
  217. rowSpan: number,
  218. sandbox: spaceSeparated,
  219. scope: null,
  220. scoped: boolean,
  221. seamless: boolean,
  222. selected: boolean,
  223. shadowRootClonable: boolean,
  224. shadowRootDelegatesFocus: boolean,
  225. shadowRootMode: null,
  226. shape: null,
  227. size: number,
  228. sizes: null,
  229. slot: null,
  230. span: number,
  231. spellCheck: booleanish,
  232. src: null,
  233. srcDoc: null,
  234. srcLang: null,
  235. srcSet: null,
  236. start: number,
  237. step: null,
  238. style: null,
  239. tabIndex: number,
  240. target: null,
  241. title: null,
  242. translate: null,
  243. type: null,
  244. typeMustMatch: boolean,
  245. useMap: null,
  246. value: booleanish,
  247. width: number,
  248. wrap: null,
  249. writingSuggestions: null,
  250. // Legacy.
  251. // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis
  252. align: null, // Several. Use CSS `text-align` instead,
  253. aLink: null, // `<body>`. Use CSS `a:active {color}` instead
  254. archive: spaceSeparated, // `<object>`. List of URIs to archives
  255. axis: null, // `<td>` and `<th>`. Use `scope` on `<th>`
  256. background: null, // `<body>`. Use CSS `background-image` instead
  257. bgColor: null, // `<body>` and table elements. Use CSS `background-color` instead
  258. border: number, // `<table>`. Use CSS `border-width` instead,
  259. borderColor: null, // `<table>`. Use CSS `border-color` instead,
  260. bottomMargin: number, // `<body>`
  261. cellPadding: null, // `<table>`
  262. cellSpacing: null, // `<table>`
  263. char: null, // Several table elements. When `align=char`, sets the character to align on
  264. charOff: null, // Several table elements. When `char`, offsets the alignment
  265. classId: null, // `<object>`
  266. clear: null, // `<br>`. Use CSS `clear` instead
  267. code: null, // `<object>`
  268. codeBase: null, // `<object>`
  269. codeType: null, // `<object>`
  270. color: null, // `<font>` and `<hr>`. Use CSS instead
  271. compact: boolean, // Lists. Use CSS to reduce space between items instead
  272. declare: boolean, // `<object>`
  273. event: null, // `<script>`
  274. face: null, // `<font>`. Use CSS instead
  275. frame: null, // `<table>`
  276. frameBorder: null, // `<iframe>`. Use CSS `border` instead
  277. hSpace: number, // `<img>` and `<object>`
  278. leftMargin: number, // `<body>`
  279. link: null, // `<body>`. Use CSS `a:link {color: *}` instead
  280. longDesc: null, // `<frame>`, `<iframe>`, and `<img>`. Use an `<a>`
  281. lowSrc: null, // `<img>`. Use a `<picture>`
  282. marginHeight: number, // `<body>`
  283. marginWidth: number, // `<body>`
  284. noResize: boolean, // `<frame>`
  285. noHref: boolean, // `<area>`. Use no href instead of an explicit `nohref`
  286. noShade: boolean, // `<hr>`. Use background-color and height instead of borders
  287. noWrap: boolean, // `<td>` and `<th>`
  288. object: null, // `<applet>`
  289. profile: null, // `<head>`
  290. prompt: null, // `<isindex>`
  291. rev: null, // `<link>`
  292. rightMargin: number, // `<body>`
  293. rules: null, // `<table>`
  294. scheme: null, // `<meta>`
  295. scrolling: booleanish, // `<frame>`. Use overflow in the child context
  296. standby: null, // `<object>`
  297. summary: null, // `<table>`
  298. text: null, // `<body>`. Use CSS `color` instead
  299. topMargin: number, // `<body>`
  300. valueType: null, // `<param>`
  301. version: null, // `<html>`. Use a doctype.
  302. vAlign: null, // Several. Use CSS `vertical-align` instead
  303. vLink: null, // `<body>`. Use CSS `a:visited {color}` instead
  304. vSpace: number, // `<img>` and `<object>`
  305. // Non-standard Properties.
  306. allowTransparency: null,
  307. autoCorrect: null,
  308. autoSave: null,
  309. disablePictureInPicture: boolean,
  310. disableRemotePlayback: boolean,
  311. prefix: null,
  312. property: null,
  313. results: number,
  314. security: null,
  315. unselectable: null
  316. },
  317. space: 'html',
  318. transform: caseInsensitiveTransform
  319. })