Skip to content

[css-values] mod() isn't needed #6637

@nmoucht

Description

@nmoucht

We in WebKit have received feedback that having both mod() and rem() is confusing. This area is already confusing due to the mod operator % being named remainder in javascript, and by adding a mod() function (which shares a name with the name of an operator when it doesn't share its behavior), it complicates things even further. Also, the mod function that the spec dictates (https://drafts.csswg.org/css-values-4/#round-func) is a weird combination of multiple math functions that I don't believe exists in any language. When the input arguments have the same sign, mod() behaves as the C function fmod, and when they have different signs, it behaves as the C function remainder. There is no need to be more expressive than javascript, which only has the % operator, so there is no reason to have any additional functions for this beyond rem(). At the very least, mod() should be modeled after an existing math function, such as C's remainder, but it would be a better solution to remove mod() entirely to avoid confusion.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions