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

Function diffProperties

docs/external/js/react-dom.development.js:6184–6362  ·  view source on GitHub ↗
(domElement, tag, lastRawProps, nextRawProps, rootContainerElement)

Source from the content-addressed store, hash-verified

6182 } // Calculate the diff between the two objects.
6183
6184 function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
6185 {
6186 validatePropertiesInDevelopment(tag, nextRawProps);
6187 }
6188
6189 var updatePayload = null;
6190 var lastProps;
6191 var nextProps;
6192
6193 switch (tag) {
6194 case 'input':
6195 lastProps = getHostProps(domElement, lastRawProps);
6196 nextProps = getHostProps(domElement, nextRawProps);
6197 updatePayload = [];
6198 break;
6199
6200 case 'option':
6201 lastProps = getHostProps$1(domElement, lastRawProps);
6202 nextProps = getHostProps$1(domElement, nextRawProps);
6203 updatePayload = [];
6204 break;
6205
6206 case 'select':
6207 lastProps = getHostProps$2(domElement, lastRawProps);
6208 nextProps = getHostProps$2(domElement, nextRawProps);
6209 updatePayload = [];
6210 break;
6211
6212 case 'textarea':
6213 lastProps = getHostProps$3(domElement, lastRawProps);
6214 nextProps = getHostProps$3(domElement, nextRawProps);
6215 updatePayload = [];
6216 break;
6217
6218 default:
6219 lastProps = lastRawProps;
6220 nextProps = nextRawProps;
6221
6222 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') {
6223 // TODO: This cast may not be sound for SVG, MathML or custom elements.
6224 trapClickOnNonInteractiveElement(domElement);
6225 }
6226
6227 break;
6228 }
6229
6230 assertValidProps(tag, nextProps);
6231 var propKey;
6232 var styleName;
6233 var styleUpdates = null;
6234
6235 for (propKey in lastProps) {
6236 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
6237 continue;
6238 }
6239
6240 if (propKey === STYLE) {
6241 var lastStyle = lastProps[propKey];

Callers 1

prepareUpdateFunction · 0.85

Calls 8

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

Tested by

no test coverage detected