* Given a fragment, validate that it can only be provided with fragment props * @param {ReactElement} fragment
(fragment)
| 19595 | * @param {ReactElement} fragment |
| 19596 | */ |
| 19597 | function validateFragmentProps(fragment) { |
| 19598 | currentlyValidatingElement = fragment; |
| 19599 | |
| 19600 | var keys = Object.keys(fragment.props); |
| 19601 | for (var i = 0; i < keys.length; i++) { |
| 19602 | var key = keys[i]; |
| 19603 | if (!VALID_FRAGMENT_PROPS.has(key)) { |
| 19604 | warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum()); |
| 19605 | break; |
| 19606 | } |
| 19607 | } |
| 19608 | |
| 19609 | if (fragment.ref !== null) { |
| 19610 | warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum()); |
| 19611 | } |
| 19612 | |
| 19613 | currentlyValidatingElement = null; |
| 19614 | } |
| 19615 | |
| 19616 | function createElementWithValidation(type, props, children) { |
| 19617 | var validType = typeof type === 'string' || typeof type === 'function' || |
no test coverage detected