Skip to content
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

Prevent tree shaking any CSS selectors based on the descendants of amp-script elements #3034

Merged
merged 1 commit into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions includes/sanitizers/class-amp-style-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class AMP_Style_Sanitizer extends AMP_Base_Sanitizer {
'amp-live-list',
'[submit-error]',
'[submit-success]',
'amp-script',
],
'should_locate_sources' => false,
'parsed_cache_variant' => null,
Expand Down
3 changes: 3 additions & 0 deletions tests/php/test-amp-style-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,12 @@ public function get_link_and_style_test_data() {
'<style amp-custom>.dead-list li .highlighted, amp-live-list li .highlighted { background: yellow }</style>',
'<style amp-custom>article.missing amp-live-list li .highlighted { background: yellow }</style>',
'<style amp-custom>body amp-list .portland { color:blue; }</style>',
'<style amp-custom>amp-script .loaded { color:brown; }</style>',
'</head><body>',
'<form method="post" action-xhr="https://example.com/subscribe" target="_top"><div submit-success><template type="amp-mustache"><b>Thanks</b>, {{name}}}</template></div></form>',
'<amp-live-list id="my-live-list" data-poll-interval="15000" data-max-items-per-page="20"><button update on="tap:my-live-list.update">You have updates!</button><ul items><li id="live-list-2-item-2" data-sort-time="1464281932879">Hello</li></ul></amp-live-list>',
'<amp-list width="auto" height="100" layout="fixed-height" src="https://ampproject-b5f4c.firebaseapp.com/examples/data/amp-list-urls.json"> <template type="amp-mustache"> <div class="url-entry"> <a href="{{url}}" class="{{class}}">{{title}}</a> </div> </template> </amp-list>',
'<amp-script src="https://example.com/populate/server/time">The current server time is <time class="loading">loading...</time>.</amp-script>',
'</body></html>',
]
),
Expand All @@ -351,6 +353,7 @@ public function get_link_and_style_test_data() {
'amp-live-list li .highlighted{background:yellow}',
'',
'body amp-list .portland{color:blue}',
'amp-script .loaded{color:brown}',
],
[],
],
Expand Down