MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / setInitialDOMProperties

Function setInitialDOMProperties

code/redux/public/app.js:16382–16432  ·  view source on GitHub ↗
(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag)

Source from the content-addressed store, hash-verified

16380}
16381
16382function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
16383 for (var propKey in nextProps) {
16384 if (!nextProps.hasOwnProperty(propKey)) {
16385 continue;
16386 }
16387 var nextProp = nextProps[propKey];
16388 if (propKey === STYLE) {
16389 {
16390 if (nextProp) {
16391 // Freeze the next style object so that we can assume it won't be
16392 // mutated. We have already warned for this in the past.
16393 Object.freeze(nextProp);
16394 }
16395 }
16396 // Relies on `updateStylesByID` not mutating `styleUpdates`.
16397 setValueForStyles(domElement, nextProp, getStack);
16398 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
16399 var nextHtml = nextProp ? nextProp[HTML] : undefined;
16400 if (nextHtml != null) {
16401 setInnerHTML(domElement, nextHtml);
16402 }
16403 } else if (propKey === CHILDREN) {
16404 if (typeof nextProp === 'string') {
16405 // Avoid setting initial textContent when the text is empty. In IE11 setting
16406 // textContent on a <textarea> will cause the placeholder to not
16407 // show within the <textarea> until it has been focused and blurred again.
16408 // https://github.com/facebook/react/issues/6731#issuecomment-254874553
16409 var canSetTextContent = tag !== 'textarea' || nextProp !== '';
16410 if (canSetTextContent) {
16411 setTextContent(domElement, nextProp);
16412 }
16413 } else if (typeof nextProp === 'number') {
16414 setTextContent(domElement, '' + nextProp);
16415 }
16416 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING$1) {
16417 // Noop
16418 } else if (propKey === AUTOFOCUS) {
16419 // We polyfill it separately on the client during commit.
16420 // We blacklist it here rather than in the property list because we emit it in SSR.
16421 } else if (registrationNameModules.hasOwnProperty(propKey)) {
16422 if (nextProp != null) {
16423 if (true && typeof nextProp !== 'function') {
16424 warnForInvalidEventListener(propKey, nextProp);
16425 }
16426 ensureListeningTo(rootContainerElement, propKey);
16427 }
16428 } else if (nextProp != null) {
16429 setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
16430 }
16431 }
16432}
16433
16434function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
16435 // TODO: Handle wasCustomComponentTag

Callers 1

setInitialProperties$1Function · 0.70

Calls 4

setValueForStylesFunction · 0.70
setTextContentFunction · 0.70
ensureListeningToFunction · 0.70
setValueForPropertyFunction · 0.70

Tested by

no test coverage detected