1
1
import { makeMap } from './makeMap'
2
2
3
- // TODO validate this list!
4
- // on the client, most of these probably has corresponding prop
5
- // or, like allowFullscreen on iframe, although case is different, the attr
6
- // affects the property properly...
7
- // Basically, we can skip this check on the client
8
- // but they are still needed during SSR to produce correct initial markup
9
- export const isBooleanAttr = makeMap (
10
- 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
11
- 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
12
- 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
13
- 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
14
- 'required,reversed,scoped,seamless,selected,sortable,translate,' +
15
- 'truespeed,typemustmatch,visible'
3
+ // On the client we only need to offer special cases for boolean attributes that
4
+ // have different names from their corresponding dom properties:
5
+ // - itemscope -> N/A
6
+ // - allowfullscreen -> allowFullscreen
7
+ // - formnovalidate -> formNoValidate
8
+ // - ismap -> isMap
9
+ // - nomodule -> noModule
10
+ // - novalidate -> noValidate
11
+ // - readonly -> readOnly
12
+ const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`
13
+ export const isSpecialBooleanAttr = /*#__PURE__*/ makeMap ( specialBooleanAttrs )
14
+
15
+ // The full list is needed during SSR to produce the correct initial markup.
16
+ export const isBooleanAttr = /*#__PURE__*/ makeMap (
17
+ specialBooleanAttrs +
18
+ `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,ismap,` +
19
+ `loop,nomodule,open,required,reversed,scoped,seamless,` +
20
+ `checked,muted,multiple,selected`
16
21
)
17
22
18
23
const unsafeAttrCharRE = / [ > / = " ' \u0009 \u000a \u000c \u0020 ] /
@@ -37,7 +42,7 @@ export const propsToAttrMap: Record<string, string | undefined> = {
37
42
}
38
43
39
44
// CSS properties that accept plain numbers
40
- export const isNoUnitNumericStyleProp = makeMap (
45
+ export const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap (
41
46
`animation-iteration-count,border-image-outset,border-image-slice,` +
42
47
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
43
48
`columns,flex,flex-grow,flex-positive,flex-shrink,flex-negative,flex-order,` +
0 commit comments