* Given a fragment, validate that it can only be provided with fragment props * @param {ReactElement} fragment
(fragment)
| 18890 | * @param {ReactElement} fragment |
| 18891 | */ |
| 18892 | function validateFragmentProps(fragment) { |
| 18893 | currentlyValidatingElement = fragment; |
| 18894 | |
| 18895 | var keys = Object.keys(fragment.props); |
| 18896 | for (var i = 0; i < keys.length; i++) { |
| 18897 | var key = keys[i]; |
| 18898 | if (!VALID_FRAGMENT_PROPS.has(key)) { |
| 18899 | warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum()); |
| 18900 | break; |
| 18901 | } |
| 18902 | } |
| 18903 | |
| 18904 | if (fragment.ref !== null) { |
| 18905 | warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum()); |
| 18906 | } |
| 18907 | |
| 18908 | currentlyValidatingElement = null; |
| 18909 | } |
| 18910 | |
| 18911 | function createElementWithValidation(type, props, children) { |
| 18912 | var validType = typeof type === 'string' || typeof type === 'function' || |
no test coverage detected