Delete unused DOM files (#26387)
These used to be used by partial render. ReactDOMDispatcher ended up not being used in this way. Move shared DOM files to client. These are only used by client abstractions now. They're inlined in the Fizz code so they're no longer shared.
Sebastian Markbåge committed
Mar 14, 2023 at 19:52 UTC
21aee59e454a875f872ca666d6eb2694425e52af
28 files changed
+25
-145
packages/react-dom-bindings/src/client/CSSPropertyOperations.js
+1
-1
@@ -7,7 +7,7 @@
7
8
import {shorthandToLonghand} from './CSSShorthandProperty';
9
10
-import dangerousStyleValue from '../shared/dangerousStyleValue';
10
+import dangerousStyleValue from './dangerousStyleValue';
11
import hyphenateStyleName from '../shared/hyphenateStyleName';
12
import warnValidStyle from '../shared/warnValidStyle';
13
packages/react-dom-bindings/src/client/DOMNamespaces.js
renamed
packages/react-dom-bindings/src/client/HTMLNodeType.js
renamed
packages/react-dom-bindings/src/client/ReactDOMComponent.js
+3
-3
@@ -55,14 +55,14 @@ import {
55
setValueForStyles,
56
validateShorthandPropertyCollisionInDev,
57
} from './CSSPropertyOperations';
58
-import {HTML_NAMESPACE, getIntrinsicNamespace} from '../shared/DOMNamespaces';
58
+import {HTML_NAMESPACE, getIntrinsicNamespace} from './DOMNamespaces';
59
import {
60
getPropertyInfo,
61
shouldIgnoreAttribute,
62
shouldRemoveAttribute,
63
} from '../shared/DOMProperty';
64
-import assertValidProps from '../shared/assertValidProps';
65
-import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
64
+import assertValidProps from './assertValidProps';
65
+import {DOCUMENT_NODE} from './HTMLNodeType';
66
import isCustomComponent from '../shared/isCustomComponent';
67
import possibleStandardNames from '../shared/possibleStandardNames';
68
import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
packages/react-dom-bindings/src/client/ReactDOMComponentTree.js
+1
-1
@@ -13,7 +13,7 @@ import type {ReactScopeInstance} from 'shared/ReactTypes';
13
import type {
14
ReactDOMEventHandle,
15
ReactDOMEventHandleListener,
16
-} from '../shared/ReactDOMTypes';
16
+} from './ReactDOMEventHandleTypes';
17
import type {
18
Container,
19
TextInstance,
packages/react-dom-bindings/src/client/ReactDOMEventHandle.js
+2
-2
@@ -12,7 +12,7 @@ import type {ReactScopeInstance} from 'shared/ReactTypes';
12
import type {
13
ReactDOMEventHandle,
14
ReactDOMEventHandleListener,
15
-} from '../shared/ReactDOMTypes';
15
+} from './ReactDOMEventHandleTypes';
16
17
import {allNativeEvents} from '../events/EventRegistry';
18
import {
@@ -21,7 +21,7 @@ import {
21
doesTargetHaveEventHandle,
22
addEventHandleToTarget,
23
} from './ReactDOMComponentTree';
24
-import {ELEMENT_NODE} from '../shared/HTMLNodeType';
24
+import {ELEMENT_NODE} from './HTMLNodeType';
25
import {listenToNativeEventForNonManagedEventTarget} from '../events/DOMPluginEventSystem';
26
27
import {
packages/react-dom-bindings/src/client/ReactDOMEventHandleTypes.js
renamed
packages/react-dom-bindings/src/client/ReactDOMFloatClient.js
+2
-2
@@ -16,8 +16,8 @@ import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals.js';
16
const {Dispatcher} = ReactDOMSharedInternals;
17
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
18
19
-import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
20
-import {SVG_NAMESPACE} from '../shared/DOMNamespaces';
19
+import {DOCUMENT_NODE} from './HTMLNodeType';
20
+import {SVG_NAMESPACE} from './DOMNamespaces';
21
import {
22
validatePreloadArguments,
23
validatePreinitArguments,
packages/react-dom-bindings/src/client/ReactDOMHostConfig.js
+3
-3
@@ -61,7 +61,7 @@ import {
61
getChildNamespace,
62
SVG_NAMESPACE,
63
MATH_NAMESPACE,
64
-} from '../shared/DOMNamespaces';
64
+} from './DOMNamespaces';
65
import {
66
ELEMENT_NODE,
67
TEXT_NODE,
@@ -69,8 +69,8 @@ import {
69
DOCUMENT_NODE,
70
DOCUMENT_TYPE_NODE,
71
DOCUMENT_FRAGMENT_NODE,
72
-} from '../shared/HTMLNodeType';
73
-import dangerousStyleValue from '../shared/dangerousStyleValue';
72
+} from './HTMLNodeType';
73
+import dangerousStyleValue from './dangerousStyleValue';
74
75
import {retryIfBlockedOn} from '../events/ReactDOMEventReplaying';
76
packages/react-dom-bindings/src/client/ReactDOMSelection.js
+1
-1
@@ -6,7 +6,7 @@
6
*/
7
8
import getNodeForCharacterOffset from './getNodeForCharacterOffset';
9
-import {TEXT_NODE} from '../shared/HTMLNodeType';
9
+import {TEXT_NODE} from './HTMLNodeType';
10
11
/**
12
* @param {DOMElement} outerNode
packages/react-dom-bindings/src/client/ReactInputSelection.js
+1
-1
@@ -8,7 +8,7 @@
8
import getActiveElement from './getActiveElement';
9
10
import {getOffsets, setOffsets} from './ReactDOMSelection';
11
-import {ELEMENT_NODE, TEXT_NODE} from '../shared/HTMLNodeType';
11
+import {ELEMENT_NODE, TEXT_NODE} from './HTMLNodeType';
12
13
function isTextNode(node) {
14
return node && node.nodeType === TEXT_NODE;
packages/react-dom-bindings/src/client/assertValidProps.js
renamed
packages/react-dom-bindings/src/client/dangerousStyleValue.js
renamed
+1
-1
@@ -5,7 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
-import {isUnitlessNumber} from './CSSProperty';
8
+import {isUnitlessNumber} from '../shared/CSSProperty';
9
import {checkCSSPropertyStringCoercion} from 'shared/CheckStringCoercion';
10
11
/**
packages/react-dom-bindings/src/client/getNodeForCharacterOffset.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import {TEXT_NODE} from '../shared/HTMLNodeType';
10
+import {TEXT_NODE} from './HTMLNodeType';
11
12
/**
13
* Given any node return the first leaf node without children.
packages/react-dom-bindings/src/client/omittedCloseTags.js
renamed
packages/react-dom-bindings/src/client/setInnerHTML.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import {SVG_NAMESPACE} from '../shared/DOMNamespaces';
10
+import {SVG_NAMESPACE} from './DOMNamespaces';
11
import createMicrosoftUnsafeLocalFunction from './createMicrosoftUnsafeLocalFunction';
12
import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';
13
packages/react-dom-bindings/src/client/setTextContent.js
+1
-1
@@ -7,7 +7,7 @@
7
* @flow
8
*/
9
10
-import {TEXT_NODE} from '../shared/HTMLNodeType';
10
+import {TEXT_NODE} from './HTMLNodeType';
11
12
/**
13
* Set the textContent property of a node. For text updates, it's faster
packages/react-dom-bindings/src/client/voidElementTags.js
renamed
packages/react-dom-bindings/src/events/DOMPluginEventSystem.js
+1
-1
@@ -43,7 +43,7 @@ import {
43
getEventListenerSet,
44
getEventHandlerListeners,
45
} from '../client/ReactDOMComponentTree';
46
-import {COMMENT_NODE, DOCUMENT_NODE} from '../shared/HTMLNodeType';
46
+import {COMMENT_NODE, DOCUMENT_NODE} from '../client/HTMLNodeType';
47
import {batchedUpdates} from './ReactDOMUpdateBatching';
48
import getListener from './getListener';
49
import {passiveBrowserEventsSupported} from './checkPassiveEvents';
packages/react-dom-bindings/src/events/getEventTarget.js
+1
-1
@@ -5,7 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
-import {TEXT_NODE} from '../shared/HTMLNodeType';
8
+import {TEXT_NODE} from '../client/HTMLNodeType';
9
10
/**
11
* Gets the target node from a native browser event by accounting for
packages/react-dom-bindings/src/events/plugins/SelectEventPlugin.js
+1
-1
@@ -23,7 +23,7 @@ import {registerTwoPhaseEvent} from '../EventRegistry';
23
import getActiveElement from '../../client/getActiveElement';
24
import {getNodeFromInstance} from '../../client/ReactDOMComponentTree';
25
import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
26
-import {DOCUMENT_NODE} from '../../shared/HTMLNodeType';
26
+import {DOCUMENT_NODE} from '../../client/HTMLNodeType';
27
import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
28
29
const skipSelectionChangeEvent =
packages/react-dom-bindings/src/server/DOMMarkupOperations.js
deleted
-82
@@ -1,82 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import {
11
- BOOLEAN,
12
- OVERLOADED_BOOLEAN,
13
- getPropertyInfo,
14
- isAttributeNameSafe,
15
- shouldIgnoreAttribute,
16
- shouldRemoveAttribute,
17
-} from '../shared/DOMProperty';
18
-import sanitizeURL from '../shared/sanitizeURL';
19
-import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
20
-import quoteAttributeValueForBrowser from './quoteAttributeValueForBrowser';
21
-
22
-/**
23
- * Operations for dealing with DOM properties.
24
- */
25
-
26
-/**
27
- * Creates markup for a property.
28
- *
29
- * @param {string} name
30
- * @param {*} value
31
- * @return {?string} Markup string, or null if the property was invalid.
32
- */
33
-export function createMarkupForProperty(name: string, value: mixed): string {
34
- const propertyInfo = getPropertyInfo(name);
35
- if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
36
- return '';
37
- }
38
- if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
39
- return '';
40
- }
41
- if (propertyInfo !== null) {
42
- const attributeName = propertyInfo.attributeName;
43
- const {type} = propertyInfo;
44
- if (type === BOOLEAN || (type === OVERLOADED_BOOLEAN && value === true)) {
45
- return attributeName + '=""';
46
- } else {
47
- if (propertyInfo.sanitizeURL) {
48
- if (__DEV__) {
49
- checkAttributeStringCoercion(value, attributeName);
50
- }
51
- value = '' + (value: any);
52
- sanitizeURL(value);
53
- }
54
- return attributeName + '=' + quoteAttributeValueForBrowser(value);
55
- }
56
- } else if (isAttributeNameSafe(name)) {
57
- return name + '=' + quoteAttributeValueForBrowser(value);
58
- }
59
- return '';
60
-}
61
-
62
-/**
63
- * Creates markup for a custom property.
64
- *
65
- * @param {string} name
66
- * @param {*} value
67
- * @return {string} Markup string, or empty string if the property was invalid.
68
- */
69
-export function createMarkupForCustomAttribute(
70
- name: string,
71
- value: mixed,
72
-): string {
73
- if (
74
- !isAttributeNameSafe(name) ||
75
- value == null ||
76
- typeof value === 'function' ||
77
- typeof value === 'symbol'
78
- ) {
79
- return '';
80
- }
81
- return name + '=' + quoteAttributeValueForBrowser(value);
82
-}
packages/react-dom-bindings/src/server/quoteAttributeValueForBrowser.js
deleted
-20
@@ -1,20 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
-import escapeTextForBrowser from './escapeTextForBrowser';
9
-
10
-/**
11
- * Escapes attribute value to prevent scripting attacks.
12
- *
13
- * @param {*} value Value to escape.
14
- * @return {string} An escaped string.
15
- */
16
-function quoteAttributeValueForBrowser(value) {
17
- return '"' + escapeTextForBrowser(value) + '"';
18
-}
19
-
20
-export default quoteAttributeValueForBrowser;
packages/react-dom-bindings/src/shared/ReactDOMDispatcher.js
deleted
-18
@@ -1,18 +0,0 @@
1
-/**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-type DispatcherType = {
11
- [string]: mixed,
12
-};
13
-
14
-const Dispatcher: {current: null | DispatcherType} = {
15
- current: null,
16
-};
17
-
18
-export default Dispatcher;
packages/react-dom/src/__tests__/ReactMount-test.js
+1
-1
@@ -9,7 +9,7 @@
9
10
'use strict';
11
12
-const {COMMENT_NODE} = require('react-dom-bindings/src/shared/HTMLNodeType');
12
+const {COMMENT_NODE} = require('react-dom-bindings/src/client/HTMLNodeType');
13
14
let React;
15
let ReactDOM;
packages/react-dom/src/client/ReactDOMLegacy.js
+1
-1
@@ -27,7 +27,7 @@ import {
27
DOCUMENT_NODE,
28
ELEMENT_NODE,
29
COMMENT_NODE,
30
-} from 'react-dom-bindings/src/shared/HTMLNodeType';
30
+} from 'react-dom-bindings/src/client/HTMLNodeType';
31
32
import {
33
createContainer,
packages/react-dom/src/client/ReactDOMRoot.js
+1
-1
@@ -66,7 +66,7 @@ import {
66
COMMENT_NODE,
67
DOCUMENT_NODE,
68
DOCUMENT_FRAGMENT_NODE,
69
-} from 'react-dom-bindings/src/shared/HTMLNodeType';
69
+} from 'react-dom-bindings/src/client/HTMLNodeType';
70
71
import {
72
createContainer,
packages/react-dom/src/test-utils/ReactTestUtils.js
+1
-1
@@ -20,7 +20,7 @@ import {
20
HostText,
21
} from 'react-reconciler/src/ReactWorkTags';
22
import {SyntheticEvent} from 'react-dom-bindings/src/events/SyntheticEvent';
23
-import {ELEMENT_NODE} from 'react-dom-bindings/src/shared/HTMLNodeType';
23
+import {ELEMENT_NODE} from 'react-dom-bindings/src/client/HTMLNodeType';
24
import {
25
rethrowCaughtError,
26
invokeGuardedCallbackAndCatchFirstError,