MCPcopy Create free account
hub / github.com/reactjs/react-rails / diffProperties

Function diffProperties

lib/assets/react-source/development/react.js:9756–9934  ·  view source on GitHub ↗
(domElement, tag, lastRawProps, nextRawProps, rootContainerElement)

Source from the content-addressed store, hash-verified

9754 } // Calculate the diff between the two objects.
9755
9756 function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
9757 {
9758 validatePropertiesInDevelopment(tag, nextRawProps);
9759 }
9760
9761 var updatePayload = null;
9762 var lastProps;
9763 var nextProps;
9764
9765 switch (tag) {
9766 case 'input':
9767 lastProps = getHostProps(domElement, lastRawProps);
9768 nextProps = getHostProps(domElement, nextRawProps);
9769 updatePayload = [];
9770 break;
9771
9772 case 'option':
9773 lastProps = getHostProps$1(domElement, lastRawProps);
9774 nextProps = getHostProps$1(domElement, nextRawProps);
9775 updatePayload = [];
9776 break;
9777
9778 case 'select':
9779 lastProps = getHostProps$2(domElement, lastRawProps);
9780 nextProps = getHostProps$2(domElement, nextRawProps);
9781 updatePayload = [];
9782 break;
9783
9784 case 'textarea':
9785 lastProps = getHostProps$3(domElement, lastRawProps);
9786 nextProps = getHostProps$3(domElement, nextRawProps);
9787 updatePayload = [];
9788 break;
9789
9790 default:
9791 lastProps = lastRawProps;
9792 nextProps = nextRawProps;
9793
9794 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
9795 // TODO: This cast may not be sound for SVG, MathML or custom elements.
9796 trapClickOnNonInteractiveElement(domElement);
9797 }
9798
9799 break;
9800 }
9801
9802 assertValidProps(tag, nextProps);
9803 var propKey;
9804 var styleName;
9805 var styleUpdates = null;
9806
9807 for (propKey in lastProps) {
9808 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
9809 continue;
9810 }
9811
9812 if (propKey === STYLE) {
9813 var lastStyle = lastProps[propKey];

Callers 1

prepareUpdateFunction · 0.85

Calls 9

getHostPropsFunction · 0.85
getHostProps$1Function · 0.85
getHostProps$2Function · 0.85
getHostProps$3Function · 0.85
ensureListeningToFunction · 0.85
assertValidPropsFunction · 0.70

Tested by

no test coverage detected