Skip to content

[css-syntax-patches-for-csstree] incorrect CSS syntax for cursor value #1703

@tyrasd

Description

@tyrasd

The value of the cursor CSS property for csstree is currently defined here as follows:

[ [ <url> | <url-set()> ] [ <x> <y> ]? ]#? [ auto | … ]

This does however not match the way the cursor css property is defined in CSS Level3 and accepted by browsers: The difference is that if the URL (or URL set) part is present, then the syntax above would not allow a comma between the URL part and the fallback-cursor, which is however required for the CSS rule to work in a browser.

A simple example CSS: url(example.png), auto does not parse in csstree when using the definition from this repo. The version with the omitted comma (url(example.png) auto) parses using the above definition, but fails to be usable in Chrome or Firefox .

As far as I can tell, the following would be the correct syntax to define the cursor CSS property:

[ [ <url> | <url-set()> ] [ <x> <y> ]? , ]* [ auto | … ]

PS: The same (incorrect) #? syntax to define the cursor property was also present in recent CSS Level4 drafts (e.g. in the version of 8 August 2025), where it was a mistake as well: see w3c/csswg-drafts#13001.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions