Home / File/ warnValidStyle.js — react Source File

warnValidStyle.js — react Source File

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

File javascript BabelCompiler Validation 2 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  cfe6bc57_232a_91d7_3473_273355d04b5b["warnValidStyle.js"]
  e3e314a2_4cee_1a10_2d68_791d5d66f89e["CSSPropertyOperations.js"]
  e3e314a2_4cee_1a10_2d68_791d5d66f89e --> cfe6bc57_232a_91d7_3473_273355d04b5b
  4ae326e8_2c2e_2843_d5a5_16edbddd103a["ReactFizzConfigDOM.js"]
  4ae326e8_2c2e_2843_d5a5_16edbddd103a --> cfe6bc57_232a_91d7_3473_273355d04b5b
  style cfe6bc57_232a_91d7_3473_273355d04b5b 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.
 */

// 'msTransform' is correct, but the other prefixes should be capitalized
const badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
const msPattern = /^-ms-/;
const hyphenPattern = /-(.)/g;

// style values shouldn't contain a semicolon
const badStyleValueWithSemicolonPattern = /;\s*$/;

const warnedStyleNames = {};
const warnedStyleValues = {};
let warnedForNaNValue = false;
let warnedForInfinityValue = false;

function camelize(string) {
  return string.replace(hyphenPattern, function (_, character) {
    return character.toUpperCase();
  });
}

function warnHyphenatedStyleName(name) {
  if (__DEV__) {
    if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
      return;
    }

    warnedStyleNames[name] = true;
    console.error(
      'Unsupported style property %s. Did you mean %s?',
      name,
      // As Andi Smith suggests
      // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
      // is converted to lowercase `ms`.
      camelize(name.replace(msPattern, 'ms-')),
    );
  }
}

function warnBadVendoredStyleName(name) {
  if (__DEV__) {
    if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
      return;
    }

    warnedStyleNames[name] = true;
    console.error(
      'Unsupported vendor-prefixed style property %s. Did you mean %s?',
      name,
      name.charAt(0).toUpperCase() + name.slice(1),
    );
  }
}

function warnStyleValueWithSemicolon(name, value) {
// ... (65 more lines)

Domain

Subdomains

Frequently Asked Questions

What does warnValidStyle.js do?
warnValidStyle.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 warnValidStyle.js?
warnValidStyle.js defines 7 function(s): camelize, warnBadVendoredStyleName, warnHyphenatedStyleName, warnStyleValueIsInfinity, warnStyleValueIsNaN, warnStyleValueWithSemicolon, warnValidStyle.
What files import warnValidStyle.js?
warnValidStyle.js is imported by 2 file(s): CSSPropertyOperations.js, ReactFizzConfigDOM.js.
Where is warnValidStyle.js in the architecture?
warnValidStyle.js is located at packages/react-dom-bindings/src/shared/warnValidStyle.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