Home / Function/ normalizeHTML() — react Function Reference

normalizeHTML() — react Function Reference

Architecture documentation for the normalizeHTML() function in ReactDOMComponent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  e6b16ab1_66ce_997c_25dd_60a9670e673b["normalizeHTML()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  e6b16ab1_66ce_997c_25dd_60a9670e673b -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e["diffHydratedCustomComponent()"]
  b3ccac7d_1304_9653_2f32_5c5e2bbc637e -->|calls| e6b16ab1_66ce_997c_25dd_60a9670e673b
  409bfd4f_a0a2_7b82_31de_9321ab006da0["diffHydratedGenericElement()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| e6b16ab1_66ce_997c_25dd_60a9670e673b
  style e6b16ab1_66ce_997c_25dd_60a9670e673b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 319–336

function normalizeHTML(parent: Element, html: string) {
  if (__DEV__) {
    // We could have created a separate document here to avoid
    // re-initializing custom elements if they exist. But this breaks
    // how <noscript> is being handled. So we use the same document.
    // See the discussion in https://github.com/facebook/react/pull/11157.
    const testElement =
      parent.namespaceURI === MATH_NAMESPACE ||
      parent.namespaceURI === SVG_NAMESPACE
        ? parent.ownerDocument.createElementNS(
            (parent.namespaceURI: any),
            parent.tagName,
          )
        : parent.ownerDocument.createElement(parent.tagName);
    testElement.innerHTML = html;
    return testElement.innerHTML;
  }
}

Domain

Subdomains

Frequently Asked Questions

What does normalizeHTML() do?
normalizeHTML() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is normalizeHTML() defined?
normalizeHTML() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 319.
What calls normalizeHTML()?
normalizeHTML() is called by 2 function(s): diffHydratedCustomComponent, diffHydratedGenericElement.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free