MCPcopy Create free account
hub / github.com/microsoft/SandDance / getValueForAttribute

Function getValueForAttribute

docs/external/js/react-dom.development.js:1269–1287  ·  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

1267 */
1268
1269 function getValueForAttribute(node, name, expected) {
1270 {
1271 if (!isAttributeNameSafe(name)) {
1272 return;
1273 }
1274
1275 if (!node.hasAttribute(name)) {
1276 return expected === undefined ? undefined : null;
1277 }
1278
1279 var value = node.getAttribute(name);
1280
1281 if (value === '' + expected) {
1282 return expected;
1283 }
1284
1285 return value;
1286 }
1287 }
1288 /**
1289 * Sets the value for a property on a node.
1290 *

Callers 1

diffHydratedPropertiesFunction · 0.85

Calls 1

isAttributeNameSafeFunction · 0.85

Tested by

no test coverage detected