Home / File/ attribute-selector-parser.ts — tailwindcss Source File

attribute-selector-parser.ts — tailwindcss Source File

Architecture documentation for attribute-selector-parser.ts, a typescript file in the tailwindcss codebase. 0 imports, 3 dependents.

File typescript OxideEngine Extractor 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27["attribute-selector-parser.ts"]
  ca83c373_c965_8bcf_df6e_ba93e9fd4c69["attribute-selector-parser.bench.ts"]
  ca83c373_c965_8bcf_df6e_ba93e9fd4c69 --> 73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27
  e7ab393f_55e4_e393_4aee_3d5068430a7f["attribute-selector-parser.test.ts"]
  e7ab393f_55e4_e393_4aee_3d5068430a7f --> 73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"]
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e --> 73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27
  style 73e07df9_b6bc_e7d7_b7c1_3151a7ee5c27 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

const TAB = 9
const LINE_BREAK = 10
const CARRIAGE_RETURN = 13
const SPACE = 32
const DOUBLE_QUOTE = 34
const DOLLAR = 36
const SINGLE_QUOTE = 39
const ASTERISK = 42
const EQUALS = 61
const UPPER_I = 73
const UPPER_S = 83
const BACKSLASH = 92
const CARET = 94
const LOWER_I = 105
const LOWER_S = 115
const PIPE = 124
const TILDE = 126
const LOWER_A = 97
const LOWER_Z = 122
const UPPER_A = 65
const UPPER_Z = 90
const ZERO = 48
const NINE = 57
const DASH = 45
const UNDERSCORE = 95

interface AttributeSelector {
  attribute: string
  operator: '=' | '~=' | '|=' | '^=' | '$=' | '*=' | null
  quote: '"' | "'" | null
  value: string | null
  sensitivity: 'i' | 's' | null
}

export function parse(input: string): AttributeSelector | null {
  // Must start with `[` and end with `]`
  if (input[0] !== '[' || input[input.length - 1] !== ']') {
    return null
  }

  let i = 1
  let start = i
  let end = input.length - 1

  // Skip whitespace, e.g.: [   data-foo]
  //                         ^^^
  while (isAsciiWhitespace(input.charCodeAt(i))) i++

  // Attribute name, e.g.: [data-foo]
  //                        ^^^^^^^^
  {
    start = i
    for (; i < end; i++) {
      let currentChar = input.charCodeAt(i)
      // Skip escaped character
      if (currentChar === BACKSLASH) {
        i++
        continue
      }
      if (currentChar >= UPPER_A && currentChar <= UPPER_Z) continue
// ... (170 more lines)

Domain

Subdomains

Frequently Asked Questions

What does attribute-selector-parser.ts do?
attribute-selector-parser.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain, Extractor subdomain.
What functions are defined in attribute-selector-parser.ts?
attribute-selector-parser.ts defines 2 function(s): isAsciiWhitespace, parse.
What files import attribute-selector-parser.ts?
attribute-selector-parser.ts is imported by 3 file(s): attribute-selector-parser.bench.ts, attribute-selector-parser.test.ts, canonicalize-candidates.ts.
Where is attribute-selector-parser.ts in the architecture?
attribute-selector-parser.ts is located at packages/tailwindcss/src/attribute-selector-parser.ts (domain: OxideEngine, subdomain: Extractor, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free