MCPcopy Index your code
hub / github.com/react/react / updateProperties

Function updateProperties

packages/react-dom-bindings/src/client/ReactDOMComponent.js:1433–1938  ·  view source on GitHub ↗
(
  domElement: Element,
  tag: string,
  lastProps: Object,
  nextProps: Object,
)

Source from the content-addressed store, hash-verified

1431}
1432
1433export function updateProperties(
1434 domElement: Element,
1435 tag: string,
1436 lastProps: Object,
1437 nextProps: Object,
1438): void {
1439 if (__DEV__) {
1440 validatePropertiesInDevelopment(tag, nextProps);
1441 }
1442
1443 switch (tag) {
1444 case 'div':
1445 case 'span':
1446 case 'svg':
1447 case 'path':
1448 case 'a':
1449 case 'g':
1450 case 'p':
1451 case 'li': {
1452 // Fast track the most common tag types
1453 break;
1454 }
1455 case 'input': {
1456 let name = null;
1457 let type = null;
1458 let value = null;
1459 let defaultValue = null;
1460 let lastDefaultValue = null;
1461 let checked = null;
1462 let defaultChecked = null;
1463 for (const propKey in lastProps) {
1464 const lastProp = lastProps[propKey];
1465 if (lastProps.hasOwnProperty(propKey) && lastProp != null) {
1466 switch (propKey) {
1467 case 'checked': {
1468 break;
1469 }
1470 case 'value': {
1471 // This is handled by updateWrapper below.
1472 break;
1473 }
1474 case 'defaultValue': {
1475 lastDefaultValue = lastProp;
1476 }
1477 // defaultChecked and defaultValue are ignored by setProp
1478 // Fallthrough
1479 default: {
1480 if (!nextProps.hasOwnProperty(propKey))
1481 setProp(domElement, tag, propKey, null, nextProps, lastProp);
1482 }
1483 }
1484 }
1485 }
1486 for (const propKey in nextProps) {
1487 const nextProp = nextProps[propKey];
1488 const lastProp = lastProps[propKey];
1489 if (
1490 nextProps.hasOwnProperty(propKey) &&

Callers 1

commitUpdateFunction · 0.90

Calls 9

trackHostMutationFunction · 0.90
updateInputFunction · 0.90
updateSelectFunction · 0.90
updateTextareaFunction · 0.90
setPropFunction · 0.85
isCustomElementFunction · 0.85
setPropOnCustomElementFunction · 0.85
errorMethod · 0.65

Tested by

no test coverage detected