@@ -2254,50 +2254,24 @@ var ReactDOMServerRenderer = function () {
2254
2254
2255
2255
for ( let component in start ) {
2256
2256
let tagStack = [ ] ;
2257
- < << << << HEAD
2258
- = === ===
2259
- let pairs = { } ;
2260
- let end ;
2261
- > >>> >>> 0 f25537ae1db80b9c030058d253b1351c3dc4f1a
2262
-
2263
- // update end index to end of tag
2264
- let tagEnd = out . indexOf ( '>' , start [ component ] ) + 1 ;
2265
- let openingTag = out . slice ( start [ component ] , tagEnd ) ;
2266
- < << << << HEAD
2267
- let end = tagEnd ;
2268
-
2269
- // Check if component is itself a self-closing tag (skip stack logic)
2270
- === === =
2271
-
2272
- end = tagEnd ;
2273
- >>> >>> > 0f25537ae1db80b9c030058d253b1351c3dc4f1a
2274
- if (out[tagEnd - 2] !== '/') {
2275
- // push the opening tag onto the stack
2276
- tagStack . push ( openingTag ) ;
2277
- // getTags(end, component, start);
2278
-
2279
- // while loop: while stack is not empty
2280
- while ( tagStack . length !== 0 ) {
2281
- // move end index forward to next tag
2282
- end = out . indexOf ( '<' , end ) ;
2283
- let newTagEnd = out . indexOf ( '>' , end ) + 1 ;
2284
- // Check for self-closing tag (skip stack logic)
2285
- if ( out [ newTagEnd - 2 ] !== '/' ) {
2286
- if ( out [ end + 1 ] !== '/' ) {
2287
- let newTag = out . slice ( end , newTagEnd ) ;
2288
- tagStack . push ( newTag ) ;
2289
- } else {
2290
- tagStack . pop ( ) ;
2291
- }
2292
- }
2293
- end = newTagEnd;
2257
+ let tagStart ;
2258
+ let tagEnd ;
2259
+
2260
+ do {
2261
+ if ( ! tagStart ) tagStart = start [ component ] ;
2262
+ else tagStart = ( out [ tagEnd ] === '<' ) ? tagEnd : out . indexOf ( '<' , tagEnd )
2263
+ tagEnd = out . indexOf ( '>' , tagStart ) + 1 ;
2264
+ // Skip stack logic for void/self-closing elements
2265
+ if ( out [ tagEnd - 2 ] !== '/' ) {
2266
+ // Push opening tags onto stack; pop closing tags off of stack
2267
+ if ( out [ tagStart + 1 ] !== '/' ) tagStack . push ( out . slice ( tagStart , tagEnd ) ) ;
2268
+ else tagStack . pop ( ) ;
2294
2269
}
2295
- }
2270
+ } while ( tagStack . length !== 0 ) ;
2271
+
2296
2272
// cache component by slicing 'out'
2297
- cache . storage . set ( component , out . slice ( start [ component ] , end ) ) ;
2298
- // cache[component] = out.slice(start[component], end);
2273
+ cache . storage . set ( component , out . slice ( start [ component ] , tagEnd ) ) ;
2299
2274
}
2300
-
2301
2275
return out ;
2302
2276
} ;
2303
2277
0 commit comments