getValueForAttribute() — react Function Reference
Architecture documentation for the getValueForAttribute() function in DOMPropertyOperations.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD f3813474_a5e9_f03c_4a35_23ffe2dc0b8d["getValueForAttribute()"] 522890fb_ccea_897f_31ad_c906efdc26f8["DOMPropertyOperations.js"] f3813474_a5e9_f03c_4a35_23ffe2dc0b8d -->|defined in| 522890fb_ccea_897f_31ad_c906efdc26f8 0b0565a6_24f0_8d2b_81dc_05dfc17a0672["diffHydratedGenericElement()"] 0b0565a6_24f0_8d2b_81dc_05dfc17a0672 -->|calls| f3813474_a5e9_f03c_4a35_23ffe2dc0b8d 7d1bc943_4b96_ef53_61c9_c0e75af52688["isAttributeNameSafe()"] f3813474_a5e9_f03c_4a35_23ffe2dc0b8d -->|calls| 7d1bc943_4b96_ef53_61c9_c0e75af52688 style f3813474_a5e9_f03c_4a35_23ffe2dc0b8d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/DOMPropertyOperations.js lines 21–54
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;
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does getValueForAttribute() do?
getValueForAttribute() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/DOMPropertyOperations.js.
Where is getValueForAttribute() defined?
getValueForAttribute() is defined in packages/react-dom-bindings/src/client/DOMPropertyOperations.js at line 21.
What does getValueForAttribute() call?
getValueForAttribute() calls 1 function(s): isAttributeNameSafe.
What calls getValueForAttribute()?
getValueForAttribute() is called by 1 function(s): diffHydratedGenericElement.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free