(type, props, rootContainerElement, parentNamespace)
| 16198 | } |
| 16199 | |
| 16200 | function createElement$1(type, props, rootContainerElement, parentNamespace) { |
| 16201 | var isCustomComponentTag = void 0; |
| 16202 | |
| 16203 | // We create tags in the namespace of their parent container, except HTML |
| 16204 | // tags get no namespace. |
| 16205 | var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement); |
| 16206 | var domElement = void 0; |
| 16207 | var namespaceURI = parentNamespace; |
| 16208 | if (namespaceURI === HTML_NAMESPACE) { |
| 16209 | namespaceURI = getIntrinsicNamespace(type); |
| 16210 | } |
| 16211 | if (namespaceURI === HTML_NAMESPACE) { |
| 16212 | { |
| 16213 | isCustomComponentTag = isCustomComponent(type, props); |
| 16214 | // Should this check be gated by parent namespace? Not sure we want to |
| 16215 | // allow <SVG> or <mATH>. |
| 16216 | warning(isCustomComponentTag || type === type.toLowerCase(), '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', type); |
| 16217 | } |
| 16218 | |
| 16219 | if (type === 'script') { |
| 16220 | // Create the script via .innerHTML so its "parser-inserted" flag is |
| 16221 | // set to true and it does not execute |
| 16222 | var div = ownerDocument.createElement('div'); |
| 16223 | div.innerHTML = '<script><' + '/script>'; // eslint-disable-line |
| 16224 | // This is guaranteed to yield a script element. |
| 16225 | var firstChild = div.firstChild; |
| 16226 | domElement = div.removeChild(firstChild); |
| 16227 | } else if (typeof props.is === 'string') { |
| 16228 | // $FlowIssue `createElement` should be updated for Web Components |
| 16229 | domElement = ownerDocument.createElement(type, { is: props.is }); |
| 16230 | } else { |
| 16231 | // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. |
| 16232 | // See discussion in https://github.com/facebook/react/pull/6896 |
| 16233 | // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 |
| 16234 | domElement = ownerDocument.createElement(type); |
| 16235 | } |
| 16236 | } else { |
| 16237 | domElement = ownerDocument.createElementNS(namespaceURI, type); |
| 16238 | } |
| 16239 | |
| 16240 | { |
| 16241 | if (namespaceURI === HTML_NAMESPACE) { |
| 16242 | if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) { |
| 16243 | warnedUnknownTags[type] = true; |
| 16244 | warning(false, 'The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type); |
| 16245 | } |
| 16246 | } |
| 16247 | } |
| 16248 | |
| 16249 | return domElement; |
| 16250 | } |
| 16251 | |
| 16252 | function createTextNode$1(text, rootContainerElement) { |
| 16253 | return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); |
nothing calls this directly
no test coverage detected