MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / getHostProps$3

Function getHostProps$3

code/composition/public/app.js:14798–14815  ·  view source on GitHub ↗

* Implements a host component that allows setting `value`, and * `defaultValue`. This differs from the traditional DOM API because value is * usually set as PCDATA children. * * If `value` is not supplied (or null/undefined), user actions that affect the * value will trigger updates

(element, props)

Source from the content-addressed store, hash-verified

14796 */
14797
14798function getHostProps$3(element, props) {
14799 var node = element;
14800 !(props.dangerouslySetInnerHTML == null) ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : void 0;
14801
14802 // Always set children to the same thing. In IE9, the selection range will
14803 // get reset if `textContent` is mutated. We could add a check in setTextContent
14804 // to only set the value if/when the value differs from the node value (which would
14805 // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this
14806 // solution. The value can be a boolean or object so that's why it's forced
14807 // to be a string.
14808 var hostProps = _assign({}, props, {
14809 value: undefined,
14810 defaultValue: undefined,
14811 children: '' + node._wrapperState.initialValue
14812 });
14813
14814 return hostProps;
14815}
14816
14817function initWrapperState$2(element, props) {
14818 var node = element;

Callers 2

setInitialProperties$1Function · 0.70
diffProperties$1Function · 0.70

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected