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

Function pushTitleImpl

packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js:3604–3651  ·  view source on GitHub ↗
(
  target: Array<Chunk | PrecomputedChunk>,
  props: Object,
)

Source from the content-addressed store, hash-verified

3602}
3603
3604function pushTitleImpl(
3605 target: Array<Chunk | PrecomputedChunk>,
3606 props: Object,
3607): null {
3608 target.push(startChunkForTag('title'));
3609
3610 let children = null;
3611 let innerHTML = null;
3612 for (const propKey in props) {
3613 if (hasOwnProperty.call(props, propKey)) {
3614 const propValue = props[propKey];
3615 if (propValue == null) {
3616 continue;
3617 }
3618 switch (propKey) {
3619 case 'children':
3620 children = propValue;
3621 break;
3622 case 'dangerouslySetInnerHTML':
3623 innerHTML = propValue;
3624 break;
3625 default:
3626 pushAttribute(target, propKey, propValue);
3627 break;
3628 }
3629 }
3630 }
3631 // Title never participate as a ViewTransition
3632 target.push(endOfStartTag);
3633
3634 const child = Array.isArray(children)
3635 ? children.length < 2
3636 ? children[0]
3637 : null
3638 : children;
3639 if (
3640 typeof child !== 'function' &&
3641 typeof child !== 'symbol' &&
3642 child !== null &&
3643 child !== undefined
3644 ) {
3645 // eslint-disable-next-line react-internal/safe-string-coercion
3646 target.push(stringToChunk(escapeTextForBrowser('' + child)));
3647 }
3648 pushInnerHTML(target, innerHTML, children);
3649 target.push(endChunkForTag('title'));
3650 return null;
3651}
3652
3653// These are used by the client if we clear a boundary and we find these, then we
3654// also clear the singleton as well.

Callers 1

pushTitleFunction · 0.85

Calls 7

stringToChunkFunction · 0.90
startChunkForTagFunction · 0.85
pushAttributeFunction · 0.85
escapeTextForBrowserFunction · 0.85
pushInnerHTMLFunction · 0.85
endChunkForTagFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected