From 11f8aa15cd11f2674660c7d7a40a74c47ced0053 Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Fri, 10 Oct 2025 12:34:49 -0700 Subject: [PATCH 1/2] Update HTML parser rules for new select parser The HTML spec was updated to remove most special parsing rules for select elements. This PR updates the logic in validateDOMNesting to match the new HTML spec so that authors can use the new parsing rules without getting errors in React. Fixes https://github.com/facebook/react/issues/33609 --- .../src/client/validateDOMNesting.js | 20 ++++--------------- .../src/__tests__/validateDOMNesting-test.js | 11 ++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/react-dom-bindings/src/client/validateDOMNesting.js b/packages/react-dom-bindings/src/client/validateDOMNesting.js index 47aef9353ba85..e02d40be797a2 100644 --- a/packages/react-dom-bindings/src/client/validateDOMNesting.js +++ b/packages/react-dom-bindings/src/client/validateDOMNesting.js @@ -180,6 +180,7 @@ const inScopeTags = [ 'th', 'marquee', 'object', + 'select', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point @@ -306,22 +307,6 @@ function isTagValidWithParent( ): boolean { // First, let's check if we're in an unusual parsing mode... switch (parentTag) { - // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect - case 'select': - return ( - tag === 'hr' || - tag === 'option' || - tag === 'optgroup' || - tag === 'script' || - tag === 'template' || - tag === '#text' - ); - case 'optgroup': - return tag === 'option' || tag === '#text'; - // Strictly speaking, seeing an