Skip to content

Recognize more size units #647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Value/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Size extends PrimitiveValue
{
/**
* vh/vw/vm(ax)/vmin/rem are absolute insofar as they don’t scale to the immediate parent (only the viewport)
* vh/vw/vm(ax)/vmin/rem/svh/lvh/dvh/svw/lvw/dvw are absolute insofar as they don’t scale to the immediate parent (only the viewport)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than having to maintain the llist of units in the comment, it might be better to make the comment generic.

Suggested change
* vh/vw/vm(ax)/vmin/rem/svh/lvh/dvh/svw/lvw/dvw are absolute insofar as they don’t scale to the immediate parent (only the viewport)
* These are absolute insofar as they don’t scale to the immediate parent (only the viewport).

*
* @var array<int, string>
*/
Expand All @@ -22,12 +22,13 @@ class Size extends PrimitiveValue
'cm', 'mm', 'mozmm', 'in',
'vh', 'dvh', 'svh', 'lvh',
'vw', 'vmin', 'vmax', 'rem',
'svw', 'lvw', 'dvw',
];

/**
* @var array<int, string>
*/
private const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr'];
private const RELATIVE_SIZE_UNITS = ['%', 'em', 'ex', 'ch', 'fr', 'cqw', 'cqh', 'cqi', 'cqb', 'cqmin', 'cqmax'];

/**
* @var array<int, string>
Expand Down