props.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. // @flow
  2. const props = {
  3. // react props
  4. // https://github.com/facebook/react/blob/5495a7f24aef85ba6937truetrue1ce962673ca9f5fde6/src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
  5. children: true,
  6. dangerouslySetInnerHTML: true,
  7. key: true,
  8. ref: true,
  9. autoFocus: true,
  10. defaultValue: true,
  11. defaultChecked: true,
  12. innerHTML: true,
  13. suppressContentEditableWarning: true,
  14. suppressHydrationWarning: true,
  15. // deprecated react prop
  16. valueLink: true,
  17. // https://github.com/facebook/react/blob/d7157651f7b72d9888ctrue123e191f9b88cd8f41e9/src/renderers/dom/shared/HTMLDOMPropertyConfig.js
  18. /**
  19. * Standard Properties
  20. */
  21. abbr: true,
  22. accept: true,
  23. acceptCharset: true,
  24. accessKey: true,
  25. action: true,
  26. allow: true,
  27. allowUserMedia: true,
  28. allowPaymentRequest: true,
  29. allowFullScreen: true,
  30. allowTransparency: true,
  31. alt: true,
  32. // specifies target context for links with `preload` type
  33. // as: true,
  34. async: true,
  35. autoComplete: true,
  36. // autoFocus is polyfilled/normalized by AutoFocusUtils
  37. // autoFocus: true,
  38. autoPlay: true,
  39. capture: true,
  40. cellPadding: true,
  41. cellSpacing: true,
  42. // keygen prop
  43. challenge: true,
  44. charSet: true,
  45. checked: true,
  46. cite: true,
  47. classID: true,
  48. className: true,
  49. cols: true,
  50. colSpan: true,
  51. content: true,
  52. contentEditable: true,
  53. contextMenu: true,
  54. controls: true,
  55. controlsList: true,
  56. coords: true,
  57. crossOrigin: true,
  58. data: true, // For `<object />` acts as `src`.
  59. dateTime: true,
  60. decoding: true,
  61. default: true,
  62. defer: true,
  63. dir: true,
  64. disabled: true,
  65. disablePictureInPicture: true,
  66. disableRemotePlayback: true,
  67. download: true,
  68. draggable: true,
  69. encType: true,
  70. enterKeyHint: true,
  71. form: true,
  72. formAction: true,
  73. formEncType: true,
  74. formMethod: true,
  75. formNoValidate: true,
  76. formTarget: true,
  77. frameBorder: true,
  78. headers: true,
  79. height: true,
  80. hidden: true,
  81. high: true,
  82. href: true,
  83. hrefLang: true,
  84. htmlFor: true,
  85. httpEquiv: true,
  86. id: true,
  87. inputMode: true,
  88. integrity: true,
  89. is: true,
  90. keyParams: true,
  91. keyType: true,
  92. kind: true,
  93. label: true,
  94. lang: true,
  95. list: true,
  96. loading: true,
  97. loop: true,
  98. low: true,
  99. // manifest: true,
  100. marginHeight: true,
  101. marginWidth: true,
  102. max: true,
  103. maxLength: true,
  104. media: true,
  105. mediaGroup: true,
  106. method: true,
  107. min: true,
  108. minLength: true,
  109. // Caution; `option.selected` is not updated if `select.multiple` is
  110. // disabled with `removeAttribute`.
  111. multiple: true,
  112. muted: true,
  113. name: true,
  114. nonce: true,
  115. noValidate: true,
  116. open: true,
  117. optimum: true,
  118. pattern: true,
  119. placeholder: true,
  120. playsInline: true,
  121. poster: true,
  122. preload: true,
  123. profile: true,
  124. radioGroup: true,
  125. readOnly: true,
  126. referrerPolicy: true,
  127. rel: true,
  128. required: true,
  129. reversed: true,
  130. role: true,
  131. rows: true,
  132. rowSpan: true,
  133. sandbox: true,
  134. scope: true,
  135. scoped: true,
  136. scrolling: true,
  137. seamless: true,
  138. selected: true,
  139. shape: true,
  140. size: true,
  141. sizes: true,
  142. // support for projecting regular DOM Elements via V1 named slots ( shadow dom )
  143. slot: true,
  144. span: true,
  145. spellCheck: true,
  146. src: true,
  147. srcDoc: true,
  148. srcLang: true,
  149. srcSet: true,
  150. start: true,
  151. step: true,
  152. style: true,
  153. summary: true,
  154. tabIndex: true,
  155. target: true,
  156. title: true,
  157. translate: true,
  158. // Setting .type throws on non-<input> tags
  159. type: true,
  160. useMap: true,
  161. value: true,
  162. width: true,
  163. wmode: true,
  164. wrap: true,
  165. /**
  166. * RDFa Properties
  167. */
  168. about: true,
  169. datatype: true,
  170. inlist: true,
  171. prefix: true,
  172. // property is also supported for OpenGraph in meta tags.
  173. property: true,
  174. resource: true,
  175. typeof: true,
  176. vocab: true,
  177. /**
  178. * Non-standard Properties
  179. */
  180. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  181. // keyboard hints.
  182. autoCapitalize: true,
  183. autoCorrect: true,
  184. // autoSave allows WebKit/Blink to persist values of input fields on page reloads
  185. autoSave: true,
  186. // color is for Safari mask-icon link
  187. color: true,
  188. // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search#incremental_This_API_has_not_been_standardized
  189. incremental: true,
  190. // used in amp html for indicating the fallback behavior
  191. // https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/placeholders/
  192. fallback: true,
  193. // https://html.spec.whatwg.org/multipage/interaction.html#inert
  194. inert: true,
  195. // itemProp, itemScope, itemType are for
  196. // Microdata support. See http://schema.org/docs/gs.html
  197. itemProp: true,
  198. itemScope: true,
  199. itemType: true,
  200. // itemID and itemRef are for Microdata support as well but
  201. // only specified in the WHATWG spec document. See
  202. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  203. itemID: true,
  204. itemRef: true,
  205. // used in amp html for eventing purposes
  206. // https://amp.dev/documentation/guides-and-tutorials/learn/common_attributes/
  207. on: true,
  208. // used in amp html for indicating that the option is selectable
  209. // https://amp.dev/documentation/components/amp-selector/
  210. option: true,
  211. // results show looking glass icon and recent searches on input
  212. // search fields in WebKit/Blink
  213. results: true,
  214. // IE-only attribute that specifies security restrictions on an iframe
  215. // as an alternative to the sandbox attribute on IE<1true
  216. security: true,
  217. // IE-only attribute that controls focus behavior
  218. unselectable: true,
  219. //
  220. // SVG properties: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
  221. // The following "onX" events have been omitted:
  222. //
  223. // onabort
  224. // onactivate
  225. // onbegin
  226. // onclick
  227. // onend
  228. // onerror
  229. // onfocusin
  230. // onfocusout
  231. // onload
  232. // onmousedown
  233. // onmousemove
  234. // onmouseout
  235. // onmouseover
  236. // onmouseup
  237. // onrepeat
  238. // onresize
  239. // onscroll
  240. // onunload
  241. accentHeight: true,
  242. accumulate: true,
  243. additive: true,
  244. alignmentBaseline: true,
  245. allowReorder: true,
  246. alphabetic: true,
  247. amplitude: true,
  248. arabicForm: true,
  249. ascent: true,
  250. attributeName: true,
  251. attributeType: true,
  252. autoReverse: true,
  253. azimuth: true,
  254. baseFrequency: true,
  255. baselineShift: true,
  256. baseProfile: true,
  257. bbox: true,
  258. begin: true,
  259. bias: true,
  260. by: true,
  261. calcMode: true,
  262. capHeight: true,
  263. clip: true,
  264. clipPathUnits: true,
  265. clipPath: true,
  266. clipRule: true,
  267. colorInterpolation: true,
  268. colorInterpolationFilters: true,
  269. colorProfile: true,
  270. colorRendering: true,
  271. contentScriptType: true,
  272. contentStyleType: true,
  273. cursor: true,
  274. cx: true,
  275. cy: true,
  276. d: true,
  277. decelerate: true,
  278. descent: true,
  279. diffuseConstant: true,
  280. direction: true,
  281. display: true,
  282. divisor: true,
  283. dominantBaseline: true,
  284. dur: true,
  285. dx: true,
  286. dy: true,
  287. edgeMode: true,
  288. elevation: true,
  289. enableBackground: true,
  290. end: true,
  291. exponent: true,
  292. externalResourcesRequired: true,
  293. fill: true,
  294. fillOpacity: true,
  295. fillRule: true,
  296. filter: true,
  297. filterRes: true,
  298. filterUnits: true,
  299. floodColor: true,
  300. floodOpacity: true,
  301. focusable: true,
  302. fontFamily: true,
  303. fontSize: true,
  304. fontSizeAdjust: true,
  305. fontStretch: true,
  306. fontStyle: true,
  307. fontVariant: true,
  308. fontWeight: true,
  309. format: true,
  310. from: true,
  311. fr: true, // valid SVG element but React will ask for removal
  312. fx: true,
  313. fy: true,
  314. g1: true,
  315. g2: true,
  316. glyphName: true,
  317. glyphOrientationHorizontal: true,
  318. glyphOrientationVertical: true,
  319. glyphRef: true,
  320. gradientTransform: true,
  321. gradientUnits: true,
  322. hanging: true,
  323. horizAdvX: true,
  324. horizOriginX: true,
  325. ideographic: true,
  326. imageRendering: true,
  327. in: true,
  328. in2: true,
  329. intercept: true,
  330. k: true,
  331. k1: true,
  332. k2: true,
  333. k3: true,
  334. k4: true,
  335. kernelMatrix: true,
  336. kernelUnitLength: true,
  337. kerning: true,
  338. keyPoints: true,
  339. keySplines: true,
  340. keyTimes: true,
  341. lengthAdjust: true,
  342. letterSpacing: true,
  343. lightingColor: true,
  344. limitingConeAngle: true,
  345. local: true,
  346. markerEnd: true,
  347. markerMid: true,
  348. markerStart: true,
  349. markerHeight: true,
  350. markerUnits: true,
  351. markerWidth: true,
  352. mask: true,
  353. maskContentUnits: true,
  354. maskUnits: true,
  355. mathematical: true,
  356. mode: true,
  357. numOctaves: true,
  358. offset: true,
  359. opacity: true,
  360. operator: true,
  361. order: true,
  362. orient: true,
  363. orientation: true,
  364. origin: true,
  365. overflow: true,
  366. overlinePosition: true,
  367. overlineThickness: true,
  368. panose1: true,
  369. paintOrder: true,
  370. pathLength: true,
  371. patternContentUnits: true,
  372. patternTransform: true,
  373. patternUnits: true,
  374. pointerEvents: true,
  375. points: true,
  376. pointsAtX: true,
  377. pointsAtY: true,
  378. pointsAtZ: true,
  379. preserveAlpha: true,
  380. preserveAspectRatio: true,
  381. primitiveUnits: true,
  382. r: true,
  383. radius: true,
  384. refX: true,
  385. refY: true,
  386. renderingIntent: true,
  387. repeatCount: true,
  388. repeatDur: true,
  389. requiredExtensions: true,
  390. requiredFeatures: true,
  391. restart: true,
  392. result: true,
  393. rotate: true,
  394. rx: true,
  395. ry: true,
  396. scale: true,
  397. seed: true,
  398. shapeRendering: true,
  399. slope: true,
  400. spacing: true,
  401. specularConstant: true,
  402. specularExponent: true,
  403. speed: true,
  404. spreadMethod: true,
  405. startOffset: true,
  406. stdDeviation: true,
  407. stemh: true,
  408. stemv: true,
  409. stitchTiles: true,
  410. stopColor: true,
  411. stopOpacity: true,
  412. strikethroughPosition: true,
  413. strikethroughThickness: true,
  414. string: true,
  415. stroke: true,
  416. strokeDasharray: true,
  417. strokeDashoffset: true,
  418. strokeLinecap: true,
  419. strokeLinejoin: true,
  420. strokeMiterlimit: true,
  421. strokeOpacity: true,
  422. strokeWidth: true,
  423. surfaceScale: true,
  424. systemLanguage: true,
  425. tableValues: true,
  426. targetX: true,
  427. targetY: true,
  428. textAnchor: true,
  429. textDecoration: true,
  430. textRendering: true,
  431. textLength: true,
  432. to: true,
  433. transform: true,
  434. u1: true,
  435. u2: true,
  436. underlinePosition: true,
  437. underlineThickness: true,
  438. unicode: true,
  439. unicodeBidi: true,
  440. unicodeRange: true,
  441. unitsPerEm: true,
  442. vAlphabetic: true,
  443. vHanging: true,
  444. vIdeographic: true,
  445. vMathematical: true,
  446. values: true,
  447. vectorEffect: true,
  448. version: true,
  449. vertAdvY: true,
  450. vertOriginX: true,
  451. vertOriginY: true,
  452. viewBox: true,
  453. viewTarget: true,
  454. visibility: true,
  455. widths: true,
  456. wordSpacing: true,
  457. writingMode: true,
  458. x: true,
  459. xHeight: true,
  460. x1: true,
  461. x2: true,
  462. xChannelSelector: true,
  463. xlinkActuate: true,
  464. xlinkArcrole: true,
  465. xlinkHref: true,
  466. xlinkRole: true,
  467. xlinkShow: true,
  468. xlinkTitle: true,
  469. xlinkType: true,
  470. xmlBase: true,
  471. xmlns: true,
  472. xmlnsXlink: true,
  473. xmlLang: true,
  474. xmlSpace: true,
  475. y: true,
  476. y1: true,
  477. y2: true,
  478. yChannelSelector: true,
  479. z: true,
  480. zoomAndPan: true,
  481. // For preact. We have this code here even though Emotion doesn't support
  482. // Preact, since @emotion/is-prop-valid is used by some libraries outside of
  483. // the context of Emotion.
  484. for: true,
  485. class: true,
  486. autofocus: true
  487. }
  488. // eslint-disable-next-line import/no-commonjs
  489. module.exports = `/^((${Object.keys(props).join(
  490. '|'
  491. )})|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/`