MCPcopy Create free account
hub / github.com/reactjs/react-rails / getValueForAttribute

Function getValueForAttribute

lib/assets/react-source/development/react.js:4946–4964  ·  view source on GitHub ↗

* 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.

(node, name, expected)

Source from the content-addressed store, hash-verified

4944 */
4945
4946 function getValueForAttribute(node, name, expected) {
4947 {
4948 if (!isAttributeNameSafe(name)) {
4949 return;
4950 }
4951
4952 if (!node.hasAttribute(name)) {
4953 return expected === undefined ? undefined : null;
4954 }
4955
4956 var value = node.getAttribute(name);
4957
4958 if (value === '' + expected) {
4959 return expected;
4960 }
4961
4962 return value;
4963 }
4964 }
4965 /**
4966 * Sets the value for a property on a node.
4967 *

Callers 1

diffHydratedPropertiesFunction · 0.85

Calls 1

isAttributeNameSafeFunction · 0.70

Tested by

no test coverage detected