Skip to content

Incorrect parsing of calc operations without spaces in parentheses #86

Open
@nex3

Description

@nex3

When a multiplication operation exists within parentheses in a calc() expression and it doesn't have spaces around the * (which it probably won't if the CSS has been minified), postcss-value-parser parses the * as though it's part of a word token with any adjacent numbers. Here's the simplest reproduction:

var pvp = require("postcss-value-parser")

pvp('calc((1*1))')

(Live on RunKit)

This returns two nested function nodes which ultimately contain a single word node with value: "1*1". Since 1*1 parses correctly at the root of the calc() expression, I'm guessing that the parser is forgetting that it's in a calc() context upon descending into the parentheses... although it seems like even outside that context 1*1 should parse as separate tokens, according to the CSS tokenizer algorithms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions