Skip to content

CSS sanitizer removes classes with a slash (/) #5021

@sboerrigter

Description

@sboerrigter

Bug Description

Classes with slashes (such as .w-1/4) are not included in the CSS output on AMP pages.

Expected Behaviour

If the HTML marktup contains a CSS class with a slash (such as class="w-1/4") the styling for that class should be included in the CSS output.

Steps to reproduce

  1. Edit a template file (such as single.php).
  2. add a CSS class with a slash (such as <h1 class="w-1/4">Blah...</h1>).
  3. add styling for that CSS class (such as .w-1/4 { width: 25%; }) or load Tailwind CSS .
  4. Visit the regular version of the page and see that the styling is applied.
  5. Visit the AMP version of the page and see that the styling is not applied.

Additional context

  • WordPress version: 5.4.2
  • Plugin version: 1.5.4
  • AMP plugin template mode: Transitional

Classes with slashes is a common practice in the popular Tailwind CSS framework.


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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions