MCPcopy Index your code
hub / github.com/react/react / pushEndInstance

Function pushEndInstance

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:4367–4428  ·  view source on GitHub ↗
(
  target: Array<Chunk | PrecomputedChunk>,
  type: string,
  props: Object,
  resumableState: ResumableState,
  formatContext: FormatContext,
)

Source from the content-addressed store, hash-verified

4365}
4366
4367export function pushEndInstance(
4368 target: Array<Chunk | PrecomputedChunk>,
4369 type: string,
4370 props: Object,
4371 resumableState: ResumableState,
4372 formatContext: FormatContext,
4373): void {
4374 switch (type) {
4375 // We expect title and script tags to always be pushed in a unit and never
4376 // return children. when we end up pushing the end tag we want to ensure
4377 // there is no extra closing tag pushed
4378 case 'title':
4379 case 'style':
4380 case 'script':
4381 // Omitted close tags
4382 // TODO: Instead of repeating this switch we could try to pass a flag from above.
4383 // That would require returning a tuple. Which might be ok if it gets inlined.
4384 // fallthrough
4385 case 'area':
4386 case 'base':
4387 case 'br':
4388 case 'col':
4389 case 'embed':
4390 case 'hr':
4391 case 'img':
4392 case 'input':
4393 case 'keygen':
4394 case 'link':
4395 case 'meta':
4396 case 'param':
4397 case 'source':
4398 case 'track':
4399 case 'wbr': {
4400 // No close tag needed.
4401 return;
4402 }
4403 // Postamble end tags
4404 // When float is enabled we omit the end tags for body and html when
4405 // they represent the Document.body and Document.documentElement Nodes.
4406 // This is so we can withhold them until the postamble when we know
4407 // we won't emit any more tags
4408 case 'body': {
4409 if (formatContext.insertionMode <= HTML_HTML_MODE) {
4410 resumableState.hasBody = true;
4411 return;
4412 }
4413 break;
4414 }
4415 case 'html':
4416 if (formatContext.insertionMode === ROOT_HTML_MODE) {
4417 resumableState.hasHtml = true;
4418 return;
4419 }
4420 break;
4421 case 'head':
4422 if (formatContext.insertionMode <= HTML_HTML_MODE) {
4423 return;
4424 }

Callers 1

renderHostElementFunction · 0.90

Calls 2

endChunkForTagFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected