Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Examples citing CSS.px API are incorrect #12

@rwaldron

Description

@rwaldron

The explainer prose in CSS Typed Object Model, which references Numeric Factory Functions ignores that CSS.px (and friends) don't actually accept an object argument.

// For the sake of playing along with this proposal's syntax, alias "px" to "_px"
let { px: _px } = CSS;

document.body.style.fontSize = 3_px;

According to this proposal's semantics, 3_px desugars to _px(Object.freeze({number: 3, string: "3"})), but _px (CSS.px) doesn't know what to do with Object.freeze({number: 3, string: "3"}), because it's expecting a number, ie. 3. As a result of this misrepresentation, the given example doesn't represent an actual use case burden to be eased by this proposal.

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