Home / File/ ReactDOMUnknownPropertyHook.js — react Source File

ReactDOMUnknownPropertyHook.js — react Source File

Architecture documentation for ReactDOMUnknownPropertyHook.js, a javascript file in the react codebase. 5 imports, 2 dependents.

File javascript BabelCompiler Validation 5 imports 2 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  7bf34687_c093_d285_ad96_da146989d7e6["ReactDOMUnknownPropertyHook.js"]
  36fcaad4_7e57_5971_700b_f932b635486a["isAttributeNameSafe.js"]
  7bf34687_c093_d285_ad96_da146989d7e6 --> 36fcaad4_7e57_5971_700b_f932b635486a
  a7faeba1_82ce_c9a3_9363_b5e70d18a977["isCustomElement.js"]
  7bf34687_c093_d285_ad96_da146989d7e6 --> a7faeba1_82ce_c9a3_9363_b5e70d18a977
  2085de17_2522_af25_8b8d_76ff7166552c["isCustomElement"]
  7bf34687_c093_d285_ad96_da146989d7e6 --> 2085de17_2522_af25_8b8d_76ff7166552c
  33ec55d6_a26f_36b1_db8a_d471c4b74b21["possibleStandardNames.js"]
  7bf34687_c093_d285_ad96_da146989d7e6 --> 33ec55d6_a26f_36b1_db8a_d471c4b74b21
  a413acd5_7541_e904_f255_d4dd9b5e5bc1["hasOwnProperty"]
  7bf34687_c093_d285_ad96_da146989d7e6 --> a413acd5_7541_e904_f255_d4dd9b5e5bc1
  1e990658_7cea_75be_1f24_2399bdf9f15b["ReactDOMComponent.js"]
  1e990658_7cea_75be_1f24_2399bdf9f15b --> 7bf34687_c093_d285_ad96_da146989d7e6
  4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"]
  4ae326e8_2c2e_2843_d5a5_16edbddd103a --> 7bf34687_c093_d285_ad96_da146989d7e6
  style 7bf34687_c093_d285_ad96_da146989d7e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
import isCustomElement from './isCustomElement';
import possibleStandardNames from './possibleStandardNames';
import hasOwnProperty from 'shared/hasOwnProperty';

const warnedProperties = {};
const EVENT_NAME_REGEX = /^on./;
const INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
const rARIA = __DEV__
  ? new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$')
  : null;
const rARIACamel = __DEV__
  ? new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$')
  : null;

function validateProperty(tagName, name, value, eventRegistry) {
  if (__DEV__) {
    if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
      return true;
    }

    const lowerCasedName = name.toLowerCase();
    if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
      console.error(
        'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' +
          'All React events are normalized to bubble, so onFocusIn and onFocusOut ' +
          'are not needed/supported by React.',
      );
      warnedProperties[name] = true;
      return true;
    }

    // Actions are special because unlike events they can have other value types.
    if (typeof value === 'function') {
      if (tagName === 'form' && name === 'action') {
        return true;
      }
      if (tagName === 'input' && name === 'formAction') {
        return true;
      }
      if (tagName === 'button' && name === 'formAction') {
        return true;
      }
    }
    // We can't rely on the event system being injected on the server.
    if (eventRegistry != null) {
      const {registrationNameDependencies, possibleRegistrationNames} =
        eventRegistry;
      if (registrationNameDependencies.hasOwnProperty(name)) {
        return true;
      }
      const registrationName = possibleRegistrationNames.hasOwnProperty(
        lowerCasedName,
// ... (315 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactDOMUnknownPropertyHook.js do?
ReactDOMUnknownPropertyHook.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactDOMUnknownPropertyHook.js?
ReactDOMUnknownPropertyHook.js defines 3 function(s): validateProperties, validateProperty, warnUnknownProperties.
What does ReactDOMUnknownPropertyHook.js depend on?
ReactDOMUnknownPropertyHook.js imports 5 module(s): hasOwnProperty, isAttributeNameSafe.js, isCustomElement, isCustomElement.js, possibleStandardNames.js.
What files import ReactDOMUnknownPropertyHook.js?
ReactDOMUnknownPropertyHook.js is imported by 2 file(s): ReactDOMComponent.js, ReactFizzConfigDOM.js.
Where is ReactDOMUnknownPropertyHook.js in the architecture?
ReactDOMUnknownPropertyHook.js is located at packages/react-dom-bindings/src/shared/ReactDOMUnknownPropertyHook.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/shared).

Analyze Your Own Codebase

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

Try Supermodel Free