DOMPropertyOperations.js — react Source File
Architecture documentation for DOMPropertyOperations.js, a javascript file in the react codebase. 6 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 390123a6_56c3_29ed_a331_44deb86078d6["DOMPropertyOperations.js"] 36fcaad4_7e57_5971_700b_f932b635486a["isAttributeNameSafe.js"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 36fcaad4_7e57_5971_700b_f932b635486a 328a0fd1_037f_e628_5343_b37fc3e7b33b["isAttributeNameSafe"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 328a0fd1_037f_e628_5343_b37fc3e7b33b 799a7834_f34c_8596_4026_015681eee732["ReactDOMComponentTree.js"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 799a7834_f34c_8596_4026_015681eee732 8344de1b_978c_be0f_eebd_38ccc4962a93["ReactFeatureFlags"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 8344de1b_978c_be0f_eebd_38ccc4962a93 0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7["CheckStringCoercion"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 0ae63ebd_b26a_05c8_1c6d_275a5f6b76c7 25d84424_c947_b3a8_ce28_cc718040eca5["ReactFiberMutationTracking"] 390123a6_56c3_29ed_a331_44deb86078d6 --> 25d84424_c947_b3a8_ce28_cc718040eca5 1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"] 1e990658_7cea_75be_1f24_2399bdf9f15b --> 390123a6_56c3_29ed_a331_44deb86078d6 style 390123a6_56c3_29ed_a331_44deb86078d6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* 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 isAttributeNameSafe from '../shared/isAttributeNameSafe';
import {enableTrustedTypesIntegration} from 'shared/ReactFeatureFlags';
import {checkAttributeStringCoercion} from 'shared/CheckStringCoercion';
import {getFiberCurrentPropsFromNode} from './ReactDOMComponentTree';
import {trackHostMutation} from 'react-reconciler/src/ReactFiberMutationTracking';
/**
* Get the value for a attribute on a node. Only used in DEV for SSR validation.
* The third argument is used as a hint of what the expected value is. Some
* attributes have multiple equivalent values.
*/
export function getValueForAttribute(
node: Element,
name: string,
expected: mixed,
): mixed {
if (__DEV__) {
if (!isAttributeNameSafe(name)) {
return;
}
if (!node.hasAttribute(name)) {
// shouldRemoveAttribute
switch (typeof expected) {
case 'function':
case 'symbol':
return expected;
case 'boolean': {
const prefix = name.toLowerCase().slice(0, 5);
if (prefix !== 'data-' && prefix !== 'aria-') {
return expected;
}
}
}
return expected === undefined ? undefined : null;
}
const value = node.getAttribute(name);
if (__DEV__) {
checkAttributeStringCoercion(expected, name);
}
if (value === '' + (expected: any)) {
return expected;
}
return value;
}
}
export function getValueForAttributeOnCustomComponent(
node: Element,
name: string,
expected: mixed,
): mixed {
// ... (176 more lines)
Domain
Subdomains
Functions
Dependencies
- CheckStringCoercion
- ReactDOMComponentTree.js
- ReactFeatureFlags
- ReactFiberMutationTracking
- isAttributeNameSafe
- isAttributeNameSafe.js
Source
Frequently Asked Questions
What does DOMPropertyOperations.js do?
DOMPropertyOperations.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in DOMPropertyOperations.js?
DOMPropertyOperations.js defines 6 function(s): getValueForAttribute, getValueForAttributeOnCustomComponent, setValueForAttribute, setValueForKnownAttribute, setValueForNamespacedAttribute, setValueForPropertyOnCustomComponent.
What does DOMPropertyOperations.js depend on?
DOMPropertyOperations.js imports 6 module(s): CheckStringCoercion, ReactDOMComponentTree.js, ReactFeatureFlags, ReactFiberMutationTracking, isAttributeNameSafe, isAttributeNameSafe.js.
What files import DOMPropertyOperations.js?
DOMPropertyOperations.js is imported by 1 file(s): ReactDOMComponent.js.
Where is DOMPropertyOperations.js in the architecture?
DOMPropertyOperations.js is located at packages/react-dom-bindings/src/client/DOMPropertyOperations.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/client).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free