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

Function getValueForAttribute

code/third-party/public/app.js:3549–3563  ·  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

3547 * attributes have multiple equivalent values.
3548 */
3549function getValueForAttribute(node, name, expected) {
3550 {
3551 if (!isAttributeNameSafe(name)) {
3552 return;
3553 }
3554 if (!node.hasAttribute(name)) {
3555 return expected === undefined ? undefined : null;
3556 }
3557 var value = node.getAttribute(name);
3558 if (value === '' + expected) {
3559 return expected;
3560 }
3561 return value;
3562 }
3563}
3564
3565/**
3566 * 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