Skip to content

Commit

Permalink
Run AMP_Script_Sanitizer first
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Aug 17, 2021
1 parent bdc673a commit 1578aba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion includes/amp-helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,11 @@ function amp_get_content_sanitizers( $post = null ) {
$native_post_forms_allowed = amp_is_native_post_form_allowed();

$sanitizers = [
// The AMP_Script_Sanitizer runs first because based on whether it allows custom scripts
// to be kept, it may impact impact the behavior of other sanitizers. For example, if custom
// scripts are kept then this is a signal that tree shaking in AMP_Style_Sanitizer cannot be
// performed.
AMP_Script_Sanitizer::class => [],
AMP_Embed_Sanitizer::class => [
'amp_to_amp_linking_enabled' => $amp_to_amp_linking_enabled,
],
Expand Down Expand Up @@ -1515,7 +1520,6 @@ function amp_get_content_sanitizers( $post = null ) {
'native_img_used' => $native_img_used,
],
AMP_Block_Sanitizer::class => [], // Note: Block sanitizer must come after embed / media sanitizers since its logic is using the already sanitized content.
AMP_Script_Sanitizer::class => [],
AMP_Style_Sanitizer::class => [
'skip_tree_shaking' => is_customize_preview(),
],
Expand Down

0 comments on commit 1578aba

Please sign in to comment.