1
1
import { makeMap } from './makeMap'
2
2
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
3
+ /**
4
+ * On the client we only need to offer special cases for boolean attributes that
5
+ * have different names from their corresponding dom properties:
6
+ * - itemscope -> N/A
7
+ * - allowfullscreen -> allowFullscreen
8
+ * - formnovalidate -> formNoValidate
9
+ * - ismap -> isMap
10
+ * - nomodule -> noModule
11
+ * - novalidate -> noValidate
12
+ * - readonly -> readOnly
13
+ */
12
14
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`
13
15
export const isSpecialBooleanAttr = /*#__PURE__*/ makeMap ( specialBooleanAttrs )
14
16
15
- // The full list is needed during SSR to produce the correct initial markup.
17
+ /**
18
+ * The full list is needed during SSR to produce the correct initial markup.
19
+ */
16
20
export const isBooleanAttr = /*#__PURE__*/ makeMap (
17
21
specialBooleanAttrs +
18
22
`,async,autofocus,autoplay,controls,default,defer,disabled,hidden,` +
@@ -41,7 +45,9 @@ export const propsToAttrMap: Record<string, string | undefined> = {
41
45
httpEquiv : 'http-equiv'
42
46
}
43
47
44
- // CSS properties that accept plain numbers
48
+ /**
49
+ * CSS properties that accept plain numbers
50
+ */
45
51
export const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap (
46
52
`animation-iteration-count,border-image-outset,border-image-slice,` +
47
53
`border-image-width,box-flex,box-flex-group,box-ordinal-group,column-count,` +
@@ -53,3 +59,27 @@ export const isNoUnitNumericStyleProp = /*#__PURE__*/ makeMap(
53
59
`fill-opacity,flood-opacity,stop-opacity,stroke-dasharray,stroke-dashoffset,` +
54
60
`stroke-miterlimit,stroke-opacity,stroke-width`
55
61
)
62
+
63
+ /**
64
+ * Known attributes, this is used for stringification of runtime static nodes
65
+ * so that we don't stringify bindings that cannot be set from HTML.
66
+ * Don't also forget to allow `data-*` and `aria-*`!
67
+ * Generated from https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes
68
+ */
69
+ export const isKnownAttr = /*#__PURE__*/ makeMap (
70
+ `accept,accept-charset,accesskey,action,align,allow,alt,async,` +
71
+ `autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,` +
72
+ `border,buffered,capture,challenge,charset,checked,cite,class,code,` +
73
+ `codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,` +
74
+ `coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,` +
75
+ `disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,` +
76
+ `formaction,formenctype,formmethod,formnovalidate,formtarget,headers,` +
77
+ `height,hidden,high,href,hreflang,http-equiv,icon,id,importance,integrity,` +
78
+ `ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,` +
79
+ `manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,` +
80
+ `open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,` +
81
+ `referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,` +
82
+ `selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,` +
83
+ `start,step,style,summary,tabindex,target,title,translate,type,usemap,` +
84
+ `value,width,wrap`
85
+ )
0 commit comments