const reservedProps = new Set ( [ 'children' , 'dangerouslySetInnerHTML' , 'defaultValue' , 'defaultChecked' , 'innerHTML' , 'suppressContentEditableWarning' , 'suppressHydrationWarning' , 'style' , ] ) ; const attributeNameMap = new Map ( [ [ 'acceptCharset' , 'accept-charset' ] , [ 'className' , 'class' ] , [ 'htmlFor' , 'for' ] , [ 'httpEquiv' , 'http-equiv' ] , ] ) ; const shouldIgnoreAttribute = ( name ) => { if ( reservedProps . has ( name ) ) return true ; if ( name . length > 2 && ( name [ 0 ] === 'o' || name [ 0 ] === 'O' ) && ( name [ 1 ] === 'n' || name [ 1 ] === 'N' ) ) { return true ; } return false ; } ; param node param name param value export const setValueForProperty = ( node , name , value ) => { if ( shouldIgnoreAttribute ( name ) ) return ; const attributeName = attributeNameMap . get ( name ) ?? name ; if ( value === null ) { node . removeAttribute ( attributeName ) ; } else { node . setAttribute ( attributeName , value + '' ) ; } } ;