MCPcopy Create free account
hub / github.com/caseywebdev/react-list / setValueForAttribute

Function setValueForAttribute

docs/index.js:4420–4439  ·  view source on GitHub ↗
(node, name, value)

Source from the content-addressed store, hash-verified

4418 return !1;
4419}
4420function setValueForAttribute(node, name, value) {
4421 if (isAttributeNameSafe(name))
4422 if (null === value) node.removeAttribute(name);
4423 else {
4424 switch (typeof value) {
4425 case "undefined":
4426 case "function":
4427 case "symbol":
4428 node.removeAttribute(name);
4429 return;
4430 case "boolean":
4431 var prefix$10 = name.toLowerCase().slice(0, 5);
4432 if ("data-" !== prefix$10 && "aria-" !== prefix$10) {
4433 node.removeAttribute(name);
4434 return;
4435 }
4436 }
4437 node.setAttribute(name, "" + value);
4438 }
4439}
4440function setValueForKnownAttribute(node, name, value) {
4441 if (null === value) node.removeAttribute(name);
4442 else {

Callers 2

setPropFunction · 0.85
setPropOnCustomElementFunction · 0.85

Calls 2

isAttributeNameSafeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…