Home / Function/ hydrateSrcObjectAttribute() — react Function Reference

hydrateSrcObjectAttribute() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  84fbfa5b_7810_e48d_c923_a57422c72f70["hydrateSrcObjectAttribute()"]
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  84fbfa5b_7810_e48d_c923_a57422c72f70 -->|defined in| 1e990658_7cea_75be_1f24_2399bdf9f15b
  409bfd4f_a0a2_7b82_31de_9321ab006da0["diffHydratedGenericElement()"]
  409bfd4f_a0a2_7b82_31de_9321ab006da0 -->|calls| 84fbfa5b_7810_e48d_c923_a57422c72f70
  befb3c8a_925e_b969_cf38_442509b5162d["warnForPropDifference()"]
  84fbfa5b_7810_e48d_c923_a57422c72f70 -->|calls| befb3c8a_925e_b969_cf38_442509b5162d
  style 84fbfa5b_7810_e48d_c923_a57422c72f70 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/client/ReactDOMComponent.js lines 2403–2434

function hydrateSrcObjectAttribute(
  domElement: Element,
  value: Blob,
  extraAttributes: Set<string>,
  serverDifferences: {[propName: string]: mixed},
): void {
  const attributeName = 'src';
  extraAttributes.delete(attributeName);
  const serverValue = domElement.getAttribute(attributeName);
  if (serverValue != null && value != null) {
    const size = value.size;
    const type = value.type;
    if (typeof size === 'number' && typeof type === 'string') {
      if (serverValue.indexOf('data:' + type + ';base64,') === 0) {
        // For Blobs we don't bother reading the actual data but just diff by checking if
        // the byte length size of the Blob maches the length of the data url.
        const prefixLength = 5 + type.length + 8;
        let byteLength = ((serverValue.length - prefixLength) / 4) * 3;
        if (serverValue[serverValue.length - 1] === '=') {
          byteLength--;
        }
        if (serverValue[serverValue.length - 2] === '=') {
          byteLength--;
        }
        if (byteLength === size) {
          return;
        }
      }
    }
  }
  warnForPropDifference('src', serverValue, value, serverDifferences);
}

Domain

Subdomains

Frequently Asked Questions

What does hydrateSrcObjectAttribute() do?
hydrateSrcObjectAttribute() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js.
Where is hydrateSrcObjectAttribute() defined?
hydrateSrcObjectAttribute() is defined in packages/react-dom-bindings/src/client/ReactDOMComponent.js at line 2403.
What does hydrateSrcObjectAttribute() call?
hydrateSrcObjectAttribute() calls 1 function(s): warnForPropDifference.
What calls hydrateSrcObjectAttribute()?
hydrateSrcObjectAttribute() is called by 1 function(s): diffHydratedGenericElement.

Analyze Your Own Codebase

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

Try Supermodel Free