From 18a47d585d78ad1e08341df64406f624df64bb57 Mon Sep 17 00:00:00 2001 From: acdlite Date: Tue, 25 Apr 2023 11:43:52 -0700 Subject: [PATCH] Change DOM HostContext to number instead of string (#26698) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: In React DOM, we use HostContext to represent the namespace of whatever is currently rendering — SVG, Math, or HTML. Because there is a fixed set of possible values, we can switch this to be a number instead. My motivation is that I want to start tracking additional information in this type, and I want to pack all of it into a single number instead of turning it into an object. For better performance. (In dev, the host context type is already an object that includes additional information, but that's dev so who cares.) Technically, before this change, the host context could be any namespace URI string, but any value other than SVG or Math was treated the same way. Only SVG and Math have special behavior. So in the new structure, there are three enum values: SVG, Math, or None, which represents the HTML namespace as well as all other possible namespaces. DiffTrain build for commit https://github.com/facebook/react/commit/8f42196892847a3dd1ab4c84eda0c8d52508ecf6. Changelog: [Internal] Reviewed By: poteto Differential Revision: D45238312 fbshipit-source-id: acf5033808ce81c4854ce2b962b4e7f5140e8c0d --- packages/react-native/Libraries/Renderer/REVISION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Renderer/REVISION b/packages/react-native/Libraries/Renderer/REVISION index c588ce63214..261ec453e07 100644 --- a/packages/react-native/Libraries/Renderer/REVISION +++ b/packages/react-native/Libraries/Renderer/REVISION @@ -1 +1 @@ -967d46c76cf9f7f35cf659a6a47c9ad456c685a8 +8f42196892847a3dd1ab4c84eda0c8d52508ecf6