Home / Function/ quoteAttributeValue() — tailwindcss Function Reference

quoteAttributeValue() — tailwindcss Function Reference

Architecture documentation for the quoteAttributeValue() function in variants.ts from the tailwindcss codebase.

Function typescript OxideEngine Scanner calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  8bd81dfb_6eba_9584_4f59_f5ef60538bce["quoteAttributeValue()"]
  db9eae47_695c_23c3_68bd_bae5bb363efe["variants.ts"]
  8bd81dfb_6eba_9584_4f59_f5ef60538bce -->|defined in| db9eae47_695c_23c3_68bd_bae5bb363efe
  c1a769fc_95ca_ceea_62f9_aedeeedf7c66["createVariants()"]
  c1a769fc_95ca_ceea_62f9_aedeeedf7c66 -->|calls| 8bd81dfb_6eba_9584_4f59_f5ef60538bce
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment()"]
  8bd81dfb_6eba_9584_4f59_f5ef60538bce -->|calls| f712ed47_45d4_4e5a_dd73_fdefa1da71da
  style 8bd81dfb_6eba_9584_4f59_f5ef60538bce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/variants.ts lines 1165–1193

function quoteAttributeValue(input: string) {
  if (input.includes('=')) {
    let [attribute, ...after] = segment(input, '=')
    let value = after.join('=').trim()

    // If the value is already quoted, skip.
    if (value[0] === "'" || value[0] === '"') {
      return input
    }

    // Handle case sensitivity flags on unescaped values
    if (value.length > 1) {
      let trailingCharacter = value[value.length - 1]
      if (
        value[value.length - 2] === ' ' &&
        (trailingCharacter === 'i' ||
          trailingCharacter === 'I' ||
          trailingCharacter === 's' ||
          trailingCharacter === 'S')
      ) {
        return `${attribute}="${value.slice(0, -2)}" ${trailingCharacter}`
      }
    }

    return `${attribute}="${value}"`
  }

  return input
}

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does quoteAttributeValue() do?
quoteAttributeValue() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/variants.ts.
Where is quoteAttributeValue() defined?
quoteAttributeValue() is defined in packages/tailwindcss/src/variants.ts at line 1165.
What does quoteAttributeValue() call?
quoteAttributeValue() calls 1 function(s): segment.
What calls quoteAttributeValue()?
quoteAttributeValue() is called by 1 function(s): createVariants.

Analyze Your Own Codebase

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

Try Supermodel Free