* Create and return a new ReactElement of the given type. * See https://reactjs.org/docs/react-api.html#createelement
(type, config, children)
| 771 | */ |
| 772 | |
| 773 | function createElement(type, config, children) { |
| 774 | var propName; // Reserved names are extracted |
| 775 | |
| 776 | var props = {}; |
| 777 | var key = null; |
| 778 | var ref = null; |
| 779 | var self = null; |
| 780 | var source = null; |
| 781 | |
| 782 | if (config != null) { |
| 783 | if (hasValidRef(config)) { |
| 784 | ref = config.ref; |
| 785 | |
| 786 | { |
| 787 | warnIfStringRefCannotBeAutoConverted(config); |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | if (hasValidKey(config)) { |
| 792 | { |
| 793 | checkKeyStringCoercion(config.key); |
| 794 | } |
| 795 | |
| 796 | key = '' + config.key; |
| 797 | } |
| 798 | |
| 799 | self = config.__self === undefined ? null : config.__self; |
| 800 | source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object |
| 801 | |
| 802 | for (propName in config) { |
| 803 | if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { |
| 804 | props[propName] = config[propName]; |
| 805 | } |
| 806 | } |
| 807 | } // Children can be more than one argument, and those are transferred onto |
| 808 | // the newly allocated props object. |
| 809 | |
| 810 | |
| 811 | var childrenLength = arguments.length - 2; |
| 812 | |
| 813 | if (childrenLength === 1) { |
| 814 | props.children = children; |
| 815 | } else if (childrenLength > 1) { |
| 816 | var childArray = Array(childrenLength); |
| 817 | |
| 818 | for (var i = 0; i < childrenLength; i++) { |
| 819 | childArray[i] = arguments[i + 2]; |
| 820 | } |
| 821 | |
| 822 | { |
| 823 | if (Object.freeze) { |
| 824 | Object.freeze(childArray); |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | props.children = childArray; |
| 829 | } // Resolve default props |
| 830 |
nothing calls this directly
no test coverage detected
searching dependent graphs…