(type, props, rootContainerElement, parentNamespace)
| 16449 | } |
| 16450 | |
| 16451 | function createElement$1(type, props, rootContainerElement, parentNamespace) { |
| 16452 | var isCustomComponentTag = void 0; |
| 16453 | |
| 16454 | // We create tags in the namespace of their parent container, except HTML |
| 16455 | // tags get no namespace. |
| 16456 | var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement); |
| 16457 | var domElement = void 0; |
| 16458 | var namespaceURI = parentNamespace; |
| 16459 | if (namespaceURI === HTML_NAMESPACE) { |
| 16460 | namespaceURI = getIntrinsicNamespace(type); |
| 16461 | } |
| 16462 | if (namespaceURI === HTML_NAMESPACE) { |
| 16463 | { |
| 16464 | isCustomComponentTag = isCustomComponent(type, props); |
| 16465 | // Should this check be gated by parent namespace? Not sure we want to |
| 16466 | // allow <SVG> or <mATH>. |
| 16467 | warning(isCustomComponentTag || type === type.toLowerCase(), '<%s /> is using uppercase HTML. Always use lowercase HTML tags ' + 'in React.', type); |
| 16468 | } |
| 16469 | |
| 16470 | if (type === 'script') { |
| 16471 | // Create the script via .innerHTML so its "parser-inserted" flag is |
| 16472 | // set to true and it does not execute |
| 16473 | var div = ownerDocument.createElement('div'); |
| 16474 | div.innerHTML = '<script><' + '/script>'; // eslint-disable-line |
| 16475 | // This is guaranteed to yield a script element. |
| 16476 | var firstChild = div.firstChild; |
| 16477 | domElement = div.removeChild(firstChild); |
| 16478 | } else if (typeof props.is === 'string') { |
| 16479 | // $FlowIssue `createElement` should be updated for Web Components |
| 16480 | domElement = ownerDocument.createElement(type, { is: props.is }); |
| 16481 | } else { |
| 16482 | // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. |
| 16483 | // See discussion in https://github.com/facebook/react/pull/6896 |
| 16484 | // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 |
| 16485 | domElement = ownerDocument.createElement(type); |
| 16486 | } |
| 16487 | } else { |
| 16488 | domElement = ownerDocument.createElementNS(namespaceURI, type); |
| 16489 | } |
| 16490 | |
| 16491 | { |
| 16492 | if (namespaceURI === HTML_NAMESPACE) { |
| 16493 | if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) { |
| 16494 | warnedUnknownTags[type] = true; |
| 16495 | 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); |
| 16496 | } |
| 16497 | } |
| 16498 | } |
| 16499 | |
| 16500 | return domElement; |
| 16501 | } |
| 16502 | |
| 16503 | function createTextNode$1(text, rootContainerElement) { |
| 16504 | return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); |
nothing calls this directly
no test coverage detected