@@ -21,15 +21,15 @@ const isArray = Array.isArray;
2121const assign = Object . assign ;
2222
2323// Global state for the current render pass
24- let beforeDiff , afterDiff , renderHook , ummountHook ;
24+ let beforeDiff , afterDiff , renderHook , ummountHook , attrHook ;
2525
2626/**
2727 * Render Preact JSX + Components to an HTML string.
2828 * @param {VNode } vnode JSX Element / VNode to render
2929 * @param {Object } [context={}] Initial root context object
3030 * @returns {string } serialized HTML
3131 */
32- export function renderToString ( vnode , context ) {
32+ export function renderToString ( vnode , context , renderOpts ) {
3333 // Performance optimization: `renderToString` is synchronous and we
3434 // therefore don't execute any effects. To do that we pass an empty
3535 // array to `options._commit` (`__c`). But we can go one step further
@@ -43,6 +43,7 @@ export function renderToString(vnode, context) {
4343 afterDiff = options [ DIFFED ] ;
4444 renderHook = options [ RENDER ] ;
4545 ummountHook = options . unmount ;
46+ attrHook = renderOpts ?. attrHook ;
4647
4748 const parent = h ( Fragment , null ) ;
4849 parent [ CHILDREN ] = [ vnode ] ;
@@ -399,6 +400,8 @@ function _renderToString(vnode, context, isSvgMode, selectValue, parent) {
399400 }
400401 }
401402
403+ if ( attrHook ) name = attrHook ( name ) ;
404+
402405 // write this attribute to the buffer
403406 if ( v != null && v !== false && typeof v !== 'function' ) {
404407 if ( v === true || v === '' ) {
0 commit comments