( domElement: Element, tag: string, lastProps: Object, nextProps: Object, )
| 1431 | } |
| 1432 | |
| 1433 | export 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) && |
no test coverage detected