Skip to content

Nu validator - Incorrect "One operand must be a number" for CSS variable calculations #355

@ahukkanen

Description

@ahukkanen

Problem

The "One operand must be a number" (operandnumber) is incorrectly reported for CSS variable calculations that contain numeric values.

Replicate

  1. Go to https://validator.w3.org/nu/#textarea
  2. Check the "CSS" box
  3. Insert the following CSS into the box
  4. Receive an error "One operand must be a number"

The CSS to insert into the text box:

.emoji-picker {
  --emoji-size: 1em;
  --content-height: calc(var(--emoji-size) * 1em);
}

This is a simplified version of the source CSS from the @joeattardi/emoji-button package on this line:
https://github.com/joeattardi/emoji-button/blob/ef8ac84e19ff7f76c955882f7dfe2acc794d1fdb/css/emoji-button.css#L72

Additional details

It seems this has broken rather recently because the same project which is validating HTML through the nu validator has successful builds for the same tests containing the same CSS on the same page 6 days ago (2021-12-03T12:45:40Z).

It also seems the NPM package has not received any updates within those 6 days (latest release 4.6.2 at 2021-11-25T03:57:10.566Z), so the next thing to inspect is the CSS validator which has received recent updates (validator-nu branch).

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