Skip to content

Proposal: normalize Declaration.name and add a raw for its original value #1976

Description

@nex3

Currently, Declaration.name represents the text of the declaration name as it was written in the stylesheet, without any parsing or normalization. For example, DISPLAY: grid will have name: "DISPLAY" and displ\61y: grid will have name: "displ\\61y". This causes bugs in downstream tools that look for specific property names—for example, Autoprefixer won't expand either of those to display: -ms-grid, despite being the CSS spec considering them semantically identical to display: grid.

I propose that PostCSS fully parses escape sequences in declaration names and converts them to lower case, so that the assumption authors are already making that the properties are in their most well-known form is guaranteed. To ensure that stylesheets remain round-trippable, I further propose that name: {raw: string, value: string} be added to Declaration.raws to contain the original representation of the declaration's name.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions