/** * Copyright (c) Facebook, Inc. and its 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 {registrationNameModules} from 'legacy-events/EventPluginRegistry'; import {canUseDOM} from 'shared/ExecutionEnvironment'; import invariant from 'shared/invariant'; import { setListenToResponderEventTypes, addResponderEventSystemEvent, removeTrappedEventListener, } from '../events/DeprecatedDOMEventResponderSystem'; import { getValueForAttribute, getValueForProperty, setValueForProperty, } from './DOMPropertyOperations'; import { initWrapperState as ReactDOMInputInitWrapperState, getHostProps as ReactDOMInputGetHostProps, postMountWrapper as ReactDOMInputPostMountWrapper, updateChecked as ReactDOMInputUpdateChecked, updateWrapper as ReactDOMInputUpdateWrapper, restoreControlledState as ReactDOMInputRestoreControlledState, } from './ReactDOMInput'; import { getHostProps as ReactDOMOptionGetHostProps, postMountWrapper as ReactDOMOptionPostMountWrapper, validateProps as ReactDOMOptionValidateProps, } from './ReactDOMOption'; import { initWrapperState as ReactDOMSelectInitWrapperState, getHostProps as ReactDOMSelectGetHostProps, postMountWrapper as ReactDOMSelectPostMountWrapper, restoreControlledState as ReactDOMSelectRestoreControlledState, postUpdateWrapper as ReactDOMSelectPostUpdateWrapper, } from './ReactDOMSelect'; import { initWrapperState as ReactDOMTextareaInitWrapperState, getHostProps as ReactDOMTextareaGetHostProps, postMountWrapper as ReactDOMTextareaPostMountWrapper, updateWrapper as ReactDOMTextareaUpdateWrapper, restoreControlledState as ReactDOMTextareaRestoreControlledState, } from './ReactDOMTextarea'; import {track} from './inputValueTracking'; import setInnerHTML from './setInnerHTML'; import setTextContent from './setTextContent'; import { TOP_ERROR, TOP_INVALID, TOP_LOAD, TOP_RESET, TOP_SUBMIT, TOP_TOGGLE, } from '../events/DOMTopLevelEventTypes'; import {mediaEventTypes} from '../events/DOMTopLevelEventTypes'; import { createDangerousStringForStyles, setValueForStyles, validateShorthandPropertyCollisionInDev, } from '../shared/CSSPropertyOperations'; import {Namespaces, getIntrinsicNamespace} from '../shared/DOMNamespaces'; import { getPropertyInfo, shouldIgnoreAttribute, shouldRemoveAttribute, } from '../shared/DOMProperty'; import assertValidProps from '../shared/assertValidProps'; import { DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE, ELEMENT_NODE, COMMENT_NODE, } from '../shared/HTMLNodeType'; import isCustomComponent from '../shared/isCustomComponent'; import possibleStandardNames from '../shared/possibleStandardNames'; import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook'; import {validateProperties as validateInputProperties} from '../shared/ReactDOMNullInputValuePropHook'; import {validateProperties as validateUnknownProperties} from '../shared/ReactDOMUnknownPropertyHook'; import {REACT_OPAQUE_ID_TYPE} from 'shared/ReactSymbols'; import { enableDeprecatedFlareAPI, enableTrustedTypesIntegration, enableModernEventSystem, } from 'shared/ReactFeatureFlags'; import { legacyListenToEvent, legacyTrapBubbledEvent, } from '../events/DOMLegacyEventPluginSystem'; import {listenToEvent} from '../events/DOMModernPluginEventSystem'; import {getEventListenerMap} from './ReactDOMComponentTree'; let didWarnInvalidHydration = false; let didWarnScriptTags = false; const DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML'; const SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning'; const SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning'; const AUTOFOCUS = 'autoFocus'; const CHILDREN = 'children'; const STYLE = 'style'; const HTML = '__html'; const DEPRECATED_flareListeners = 'DEPRECATED_flareListeners'; const {html: HTML_NAMESPACE} = Namespaces; let warnedUnknownTags; let suppressHydrationWarning; let validatePropertiesInDevelopment; let warnForTextDifference; let warnForPropDifference; let warnForExtraAttributes; let warnForInvalidEventListener; let canDiffStyleForHydrationWarning; let normalizeMarkupForTextOrAttribute; let normalizeHTML; if (__DEV__) { warnedUnknownTags = { // Chrome is the only major browser not shipping