-
Notifications
You must be signed in to change notification settings - Fork 382
CSS Parser does not preserve styles used inside templates script[type=text/plain] #4276
Copy link
Copy link
Labels
BugSomething isn't workingSomething isn't workingCSSQA passedHas passed QA and is doneHas passed QA and is done
Milestone
Description
Bug Description
The plugin implements the removal of unused CSS rules on the page. This works well for all page content, including <template type="amp-mustache">...</template>, but does not work with <script type="text/plain" template="amp-mustache">...</script>.
Expected Behaviour
Preserve CSS rules for elements inside <script type="text/plain" template="amp-mustache">...</script>.
Steps to reproduce
- Add code to AMP page:
<style>
h2.one { color: green }
h2.two { color: red }
</style>
<template type="amp-mustache">
<h2 class="one">One</h2>
</template>
<script type="text/plain" template="amp-mustache">
<h2 class="two">Two</h2>
</script>- View the resulting source code for an AMP page.
- See content
<style amp-custom>...</style>in page head where there is a ruleh2.one{color:green}but there is no ruleh2.two{color:red}.
Additional context
- WordPress version: 5.3.2
- Plugin version: 1.4.2
- AMP plugin template mode: Website; Standard; Serve all templates as AMP regardless of what is being queried.
- PHP version: 7.3.11
Acceptance criteria
Implementation brief
QA testing instructions
Demo
Changelog entry
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't workingCSSQA passedHas passed QA and is doneHas passed QA and is done