@@ -21,15 +21,15 @@ const isArray = Array.isArray;
21
21
const assign = Object . assign ;
22
22
23
23
// Global state for the current render pass
24
- let beforeDiff , afterDiff , renderHook , ummountHook ;
24
+ let beforeDiff , afterDiff , renderHook , ummountHook , attrHook ;
25
25
26
26
/**
27
27
* Render Preact JSX + Components to an HTML string.
28
28
* @param {VNode } vnode JSX Element / VNode to render
29
29
* @param {Object } [context={}] Initial root context object
30
30
* @returns {string } serialized HTML
31
31
*/
32
- export function renderToString ( vnode , context ) {
32
+ export function renderToString ( vnode , context , renderOpts ) {
33
33
// Performance optimization: `renderToString` is synchronous and we
34
34
// therefore don't execute any effects. To do that we pass an empty
35
35
// array to `options._commit` (`__c`). But we can go one step further
@@ -43,6 +43,7 @@ export function renderToString(vnode, context) {
43
43
afterDiff = options [ DIFFED ] ;
44
44
renderHook = options [ RENDER ] ;
45
45
ummountHook = options . unmount ;
46
+ attrHook = renderOpts ?. attrHook ;
46
47
47
48
const parent = h ( Fragment , null ) ;
48
49
parent [ CHILDREN ] = [ vnode ] ;
@@ -399,6 +400,8 @@ function _renderToString(vnode, context, isSvgMode, selectValue, parent) {
399
400
}
400
401
}
401
402
403
+ if ( attrHook ) name = attrHook ( name ) ;
404
+
402
405
// write this attribute to the buffer
403
406
if ( v != null && v !== false && typeof v !== 'function' ) {
404
407
if ( v === true || v === '' ) {
0 commit comments