Skip to content

PHP CSS Parser fails to parse turn CSS unit #4604

@westonruter

Description

@westonruter

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:

image

Whereas the AMP does not (and no animation appears):

image

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

QA testing instructions

Demo

Changelog entry

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingCSSChangeloggedWhether the issue/PR has been added to release notes.P1Medium priorityWS:CoreWork stream for Plugin core

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions