MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getValueForAttribute

Function getValueForAttribute

code/composition/public/app.js:4454–4468  ·  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

4452 * attributes have multiple equivalent values.
4453 */
4454function getValueForAttribute(node, name, expected) {
4455 {
4456 if (!isAttributeNameSafe(name)) {
4457 return;
4458 }
4459 if (!node.hasAttribute(name)) {
4460 return expected === undefined ? undefined : null;
4461 }
4462 var value = node.getAttribute(name);
4463 if (value === '' + expected) {
4464 return expected;
4465 }
4466 return value;
4467 }
4468}
4469
4470/**
4471 * Sets the value for a property on a node.

Callers 1

diffHydratedProperties$1Function · 0.70

Calls 1

isAttributeNameSafeFunction · 0.70

Tested by

no test coverage detected