Skip to content

Commit

Permalink
Fix nodeName to UPPERCASE in insertStylesheetIntoRoot (#28255)
Browse files Browse the repository at this point in the history
## Summary

<!--
Explain the **motivation** for making this change. What existing problem
does the pull request solve?
-->

<img width="518" alt="image"
src="https://github.com/facebook/react/assets/18693190/6d12df76-7dae-403b-b486-4940992abe8d">

The condition `node.nodeName === 'link'` is always `false`, because
`node.nodeName` is Uppercase in specification. And the condition
`node.nodeName === 'LINK'` is unnecessary, because Fizz hoists tags when
it's `media` attribute is `"not all"`, whether it is a `link` or a
`style` (line 36):


https://github.com/facebook/react/blob/18cbcbf783377c5a22277a63ae41af54504502e0/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetExternalRuntime.js#L30-L44


https://github.com/facebook/react/blob/18cbcbf783377c5a22277a63ae41af54504502e0/packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetInlineSource.js#L30-L44
  • Loading branch information
sweetliquid committed Sep 14, 2024
1 parent 3d95c43 commit b75cc07
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3520,7 +3520,7 @@ function insertStylesheetIntoRoot(
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (
node.nodeName === 'link' ||
node.nodeName === 'LINK' ||
// We omit style tags with media="not all" because they are not in the right position
// and will be hoisted by the Fizz runtime imminently.
node.getAttribute('media') !== 'not all'
Expand Down

0 comments on commit b75cc07

Please sign in to comment.