-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Bug Description
The PHP CSS Parser is failing to parse the CSS units vmin and vmax, inserting spaces so they become vm in and vm ax.
Similarly, the turn unit is also corrupted but in a different way: 1turn gets serialized out as 1 turn which is a syntax error.
Originally reported in the support forum.
Expected Behaviour
All CSS units should be preserved.
Steps to reproduce
Add this HTML to a Custom HTML block:
<div id="box">
I should be 20vmin×20vmax in size (and be spinning)!
</div>
<style>
#box {
width: 20vmin;
height: 20vmax;
border: solid 1px red;
background-color: gray;
animation: spin 12s linear infinite;
}
@keyframes spin {
to {
transform: rotate(1turn);
}
}
</style>Compare the AMP with the non-AMP version. The non-AMP version appears as a box and spins:
Whereas the AMP does not (and no animation appears):
Update: In develop it the element now appears as a box. The vmax and vmin units were fixed with #4610.
The PHP CSS Parser incorrectly is injecting spaces into the units:
@keyframes spin{
to {
transform: rotate(1 turn)
}
}Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
- Submitting a patch to fix the PHP-CSS-Parser will likely be required.
- Extend any regexes used for units, or rather put
vminandvmaxfirst beforevm. - Add support for
turnunit. - See https://github.com/sabberworm/PHP-CSS-Parser/blob/841f69742e23eceff24a4d55f3d9d8a63e753eac/lib/Sabberworm/CSS/Value/Size.php#L9

