MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / setInitialProperties$1

Function setInitialProperties$1

code/composition/public/app.js:16394–16504  ·  view source on GitHub ↗
(domElement, tag, rawProps, rootContainerElement)

Source from the content-addressed store, hash-verified

16392}
16393
16394function setInitialProperties$1(domElement, tag, rawProps, rootContainerElement) {
16395 var isCustomComponentTag = isCustomComponent(tag, rawProps);
16396 {
16397 validatePropertiesInDevelopment(tag, rawProps);
16398 if (isCustomComponentTag && !didWarnShadyDOM && domElement.shadyRoot) {
16399 warning(false, '%s is using shady DOM. Using shady DOM with React can ' + 'cause things to break subtly.', getCurrentFiberOwnerName$2() || 'A component');
16400 didWarnShadyDOM = true;
16401 }
16402 }
16403
16404 // TODO: Make sure that we check isMounted before firing any of these events.
16405 var props = void 0;
16406 switch (tag) {
16407 case 'iframe':
16408 case 'object':
16409 trapBubbledEvent('topLoad', 'load', domElement);
16410 props = rawProps;
16411 break;
16412 case 'video':
16413 case 'audio':
16414 // Create listener for each media event
16415 for (var event in mediaEventTypes) {
16416 if (mediaEventTypes.hasOwnProperty(event)) {
16417 trapBubbledEvent(event, mediaEventTypes[event], domElement);
16418 }
16419 }
16420 props = rawProps;
16421 break;
16422 case 'source':
16423 trapBubbledEvent('topError', 'error', domElement);
16424 props = rawProps;
16425 break;
16426 case 'img':
16427 case 'image':
16428 case 'link':
16429 trapBubbledEvent('topError', 'error', domElement);
16430 trapBubbledEvent('topLoad', 'load', domElement);
16431 props = rawProps;
16432 break;
16433 case 'form':
16434 trapBubbledEvent('topReset', 'reset', domElement);
16435 trapBubbledEvent('topSubmit', 'submit', domElement);
16436 props = rawProps;
16437 break;
16438 case 'details':
16439 trapBubbledEvent('topToggle', 'toggle', domElement);
16440 props = rawProps;
16441 break;
16442 case 'input':
16443 initWrapperState(domElement, rawProps);
16444 props = getHostProps(domElement, rawProps);
16445 trapBubbledEvent('topInvalid', 'invalid', domElement);
16446 // For controlled components we always need to ensure we're listening
16447 // to onChange. Even if there is no listener.
16448 ensureListeningTo(rootContainerElement, 'onChange');
16449 break;
16450 case 'option':
16451 validateProps(domElement, rawProps);

Callers

nothing calls this directly

Calls 15

warningFunction · 0.85
isCustomComponentFunction · 0.70
trapBubbledEventFunction · 0.70
initWrapperStateFunction · 0.70
getHostPropsFunction · 0.70
ensureListeningToFunction · 0.70
validatePropsFunction · 0.70
getHostProps$1Function · 0.70
initWrapperState$1Function · 0.70
getHostProps$2Function · 0.70
initWrapperState$2Function · 0.70
getHostProps$3Function · 0.70

Tested by

no test coverage detected