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.
This commit is contained in:
Sebastian Markbåge 2023-03-14 19:52:57 -04:00 committed by GitHub
parent 56a3c18e56
commit 21aee59e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 25 additions and 145 deletions

View File

@ -7,7 +7,7 @@
import {shorthandToLonghand} from './CSSShorthandProperty';
import dangerousStyleValue from '../shared/dangerousStyleValue';
import dangerousStyleValue from './dangerousStyleValue';
import hyphenateStyleName from '../shared/hyphenateStyleName';
import warnValidStyle from '../shared/warnValidStyle';

View File

@ -55,14 +55,14 @@ import {
setValueForStyles,
validateShorthandPropertyCollisionInDev,
} from './CSSPropertyOperations';
import {HTML_NAMESPACE, getIntrinsicNamespace} from '../shared/DOMNamespaces';
import {HTML_NAMESPACE, getIntrinsicNamespace} from './DOMNamespaces';
import {
getPropertyInfo,
shouldIgnoreAttribute,
shouldRemoveAttribute,
} from '../shared/DOMProperty';
import assertValidProps from '../shared/assertValidProps';
import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
import assertValidProps from './assertValidProps';
import {DOCUMENT_NODE} from './HTMLNodeType';
import isCustomComponent from '../shared/isCustomComponent';
import possibleStandardNames from '../shared/possibleStandardNames';
import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';

View File

@ -13,7 +13,7 @@ import type {ReactScopeInstance} from 'shared/ReactTypes';
import type {
ReactDOMEventHandle,
ReactDOMEventHandleListener,
} from '../shared/ReactDOMTypes';
} from './ReactDOMEventHandleTypes';
import type {
Container,
TextInstance,

View File

@ -12,7 +12,7 @@ import type {ReactScopeInstance} from 'shared/ReactTypes';
import type {
ReactDOMEventHandle,
ReactDOMEventHandleListener,
} from '../shared/ReactDOMTypes';
} from './ReactDOMEventHandleTypes';
import {allNativeEvents} from '../events/EventRegistry';
import {
@ -21,7 +21,7 @@ import {
doesTargetHaveEventHandle,
addEventHandleToTarget,
} from './ReactDOMComponentTree';
import {ELEMENT_NODE} from '../shared/HTMLNodeType';
import {ELEMENT_NODE} from './HTMLNodeType';
import {listenToNativeEventForNonManagedEventTarget} from '../events/DOMPluginEventSystem';
import {

View File

@ -16,8 +16,8 @@ import ReactDOMSharedInternals from 'shared/ReactDOMSharedInternals.js';
const {Dispatcher} = ReactDOMSharedInternals;
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import {DOCUMENT_NODE} from '../shared/HTMLNodeType';
import {SVG_NAMESPACE} from '../shared/DOMNamespaces';
import {DOCUMENT_NODE} from './HTMLNodeType';
import {SVG_NAMESPACE} from './DOMNamespaces';
import {
validatePreloadArguments,
validatePreinitArguments,

View File

@ -61,7 +61,7 @@ import {
getChildNamespace,
SVG_NAMESPACE,
MATH_NAMESPACE,
} from '../shared/DOMNamespaces';
} from './DOMNamespaces';
import {
ELEMENT_NODE,
TEXT_NODE,
@ -69,8 +69,8 @@ import {
DOCUMENT_NODE,
DOCUMENT_TYPE_NODE,
DOCUMENT_FRAGMENT_NODE,
} from '../shared/HTMLNodeType';
import dangerousStyleValue from '../shared/dangerousStyleValue';
} from './HTMLNodeType';
import dangerousStyleValue from './dangerousStyleValue';
import {retryIfBlockedOn} from '../events/ReactDOMEventReplaying';

View File

@ -6,7 +6,7 @@
*/
import getNodeForCharacterOffset from './getNodeForCharacterOffset';
import {TEXT_NODE} from '../shared/HTMLNodeType';
import {TEXT_NODE} from './HTMLNodeType';
/**
* @param {DOMElement} outerNode

View File

@ -8,7 +8,7 @@
import getActiveElement from './getActiveElement';
import {getOffsets, setOffsets} from './ReactDOMSelection';
import {ELEMENT_NODE, TEXT_NODE} from '../shared/HTMLNodeType';
import {ELEMENT_NODE, TEXT_NODE} from './HTMLNodeType';
function isTextNode(node) {
return node && node.nodeType === TEXT_NODE;

View File

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {isUnitlessNumber} from './CSSProperty';
import {isUnitlessNumber} from '../shared/CSSProperty';
import {checkCSSPropertyStringCoercion} from 'shared/CheckStringCoercion';
/**

View File

@ -7,7 +7,7 @@
* @flow
*/
import {TEXT_NODE} from '../shared/HTMLNodeType';
import {TEXT_NODE} from './HTMLNodeType';
/**
* Given any node return the first leaf node without children.

View File

@ -7,7 +7,7 @@
* @flow
*/
import {SVG_NAMESPACE} from '../shared/DOMNamespaces';
import {SVG_NAMESPACE} from './DOMNamespaces';
import createMicrosoftUnsafeLocalFunction from './createMicrosoftUnsafeLocalFunction';
import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';

View File

@ -7,7 +7,7 @@
* @flow
*/
import {TEXT_NODE} from '../shared/HTMLNodeType';
import {TEXT_NODE} from './HTMLNodeType';
/**
* Set the textContent property of a node. For text updates, it's faster

View File

@ -43,7 +43,7 @@ import {
getEventListenerSet,
getEventHandlerListeners,
} from '../client/ReactDOMComponentTree';
import {COMMENT_NODE, DOCUMENT_NODE} from '../shared/HTMLNodeType';
import {COMMENT_NODE, DOCUMENT_NODE} from '../client/HTMLNodeType';
import {batchedUpdates} from './ReactDOMUpdateBatching';
import getListener from './getListener';
import {passiveBrowserEventsSupported} from './checkPassiveEvents';

View File

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {TEXT_NODE} from '../shared/HTMLNodeType';
import {TEXT_NODE} from '../client/HTMLNodeType';
/**
* Gets the target node from a native browser event by accounting for

View File

@ -23,7 +23,7 @@ import {registerTwoPhaseEvent} from '../EventRegistry';
import getActiveElement from '../../client/getActiveElement';
import {getNodeFromInstance} from '../../client/ReactDOMComponentTree';
import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
import {DOCUMENT_NODE} from '../../shared/HTMLNodeType';
import {DOCUMENT_NODE} from '../../client/HTMLNodeType';
import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
const skipSelectionChangeEvent =

View File

@ -1,82 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {
BOOLEAN,
OVERLOADED_BOOLEAN,
getPropertyInfo,
isAttributeNameSafe,
shouldIgnoreAttribute,
shouldRemoveAttribute,
} from '../shared/DOMProperty';
import sanitizeURL from '../shared/sanitizeURL';
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import quoteAttributeValueForBrowser from './quoteAttributeValueForBrowser';
/**
* Operations for dealing with DOM properties.
*/
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
export function createMarkupForProperty(name: string, value: mixed): string {
const propertyInfo = getPropertyInfo(name);
if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
return '';
}
if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
return '';
}
if (propertyInfo !== null) {
const attributeName = propertyInfo.attributeName;
const {type} = propertyInfo;
if (type === BOOLEAN || (type === OVERLOADED_BOOLEAN && value === true)) {
return attributeName + '=""';
} else {
if (propertyInfo.sanitizeURL) {
if (__DEV__) {
checkAttributeStringCoercion(value, attributeName);
}
value = '' + (value: any);
sanitizeURL(value);
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
}
} else if (isAttributeNameSafe(name)) {
return name + '=' + quoteAttributeValueForBrowser(value);
}
return '';
}
/**
* Creates markup for a custom property.
*
* @param {string} name
* @param {*} value
* @return {string} Markup string, or empty string if the property was invalid.
*/
export function createMarkupForCustomAttribute(
name: string,
value: mixed,
): string {
if (
!isAttributeNameSafe(name) ||
value == null ||
typeof value === 'function' ||
typeof value === 'symbol'
) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
}

View File

@ -1,20 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import escapeTextForBrowser from './escapeTextForBrowser';
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextForBrowser(value) + '"';
}
export default quoteAttributeValueForBrowser;

View File

@ -1,18 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
type DispatcherType = {
[string]: mixed,
};
const Dispatcher: {current: null | DispatcherType} = {
current: null,
};
export default Dispatcher;

View File

@ -9,7 +9,7 @@
'use strict';
const {COMMENT_NODE} = require('react-dom-bindings/src/shared/HTMLNodeType');
const {COMMENT_NODE} = require('react-dom-bindings/src/client/HTMLNodeType');
let React;
let ReactDOM;

View File

@ -27,7 +27,7 @@ import {
DOCUMENT_NODE,
ELEMENT_NODE,
COMMENT_NODE,
} from 'react-dom-bindings/src/shared/HTMLNodeType';
} from 'react-dom-bindings/src/client/HTMLNodeType';
import {
createContainer,

View File

@ -66,7 +66,7 @@ import {
COMMENT_NODE,
DOCUMENT_NODE,
DOCUMENT_FRAGMENT_NODE,
} from 'react-dom-bindings/src/shared/HTMLNodeType';
} from 'react-dom-bindings/src/client/HTMLNodeType';
import {
createContainer,

View File

@ -20,7 +20,7 @@ import {
HostText,
} from 'react-reconciler/src/ReactWorkTags';
import {SyntheticEvent} from 'react-dom-bindings/src/events/SyntheticEvent';
import {ELEMENT_NODE} from 'react-dom-bindings/src/shared/HTMLNodeType';
import {ELEMENT_NODE} from 'react-dom-bindings/src/client/HTMLNodeType';
import {
rethrowCaughtError,
invokeGuardedCallbackAndCatchFirstError,