Home / File/ escapeSelectorAttributeValueInsideDoubleQuotes.js — react Source File

escapeSelectorAttributeValueInsideDoubleQuotes.js — react Source File

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

File javascript BabelCompiler Validation 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  c38b522a_09fe_b5a4_b72d_c1b652effb2e["escapeSelectorAttributeValueInsideDoubleQuotes.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602["ReactDOMInput.js"]
  ebd36fdb_cc70_52b6_9971_bcace1958602 --> c38b522a_09fe_b5a4_b72d_c1b652effb2e
  9c694103_7f39_88d0_6b4d_f9b2ffed5731["ReactFiberConfigDOM.js"]
  9c694103_7f39_88d0_6b4d_f9b2ffed5731 --> c38b522a_09fe_b5a4_b72d_c1b652effb2e
  style c38b522a_09fe_b5a4_b72d_c1b652effb2e 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.
 *
 * @flow
 */

// When passing user input into querySelector(All) the embedded string must not alter
// the semantics of the query. This escape function is safe to use when we know the
// provided value is going to be wrapped in double quotes as part of an attribute selector
// Do not use it anywhere else
// we escape double quotes and backslashes
const escapeSelectorAttributeValueInsideDoubleQuotesRegex = /[\n\"\\]/g;
export default function escapeSelectorAttributeValueInsideDoubleQuotes(
  value: string,
): string {
  return value.replace(
    escapeSelectorAttributeValueInsideDoubleQuotesRegex,
    ch => '\\' + ch.charCodeAt(0).toString(16) + ' ',
  );
}

Domain

Subdomains

Frequently Asked Questions

What does escapeSelectorAttributeValueInsideDoubleQuotes.js do?
escapeSelectorAttributeValueInsideDoubleQuotes.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 escapeSelectorAttributeValueInsideDoubleQuotes.js?
escapeSelectorAttributeValueInsideDoubleQuotes.js defines 1 function(s): escapeSelectorAttributeValueInsideDoubleQuotes.
What files import escapeSelectorAttributeValueInsideDoubleQuotes.js?
escapeSelectorAttributeValueInsideDoubleQuotes.js is imported by 2 file(s): ReactDOMInput.js, ReactFiberConfigDOM.js.
Where is escapeSelectorAttributeValueInsideDoubleQuotes.js in the architecture?
escapeSelectorAttributeValueInsideDoubleQuotes.js is located at packages/react-dom-bindings/src/client/escapeSelectorAttributeValueInsideDoubleQuotes.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/client).

Analyze Your Own Codebase

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

Try Supermodel Free