Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created September 9, 2019 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/77ef69f59c25127f0b6d3e59b10a5930 to your computer and use it in GitHub Desktop.
Save westonruter/77ef69f59c25127f0b6d3e59b10a5930 to your computer and use it in GitHub Desktop.
diff --git a/includes/sanitizers/class-amp-style-sanitizer.php b/includes/sanitizers/class-amp-style-sanitizer.php
index 988c4942..87d0c470 100644
--- a/includes/sanitizers/class-amp-style-sanitizer.php
+++ b/includes/sanitizers/class-amp-style-sanitizer.php
@@ -667,6 +667,15 @@ class AMP_Style_Sanitizer extends AMP_Base_Sanitizer {
$this->used_attributes[ $attribute_name ] = ( 0 !== $this->xpath->query( $expression )->length );
}
+
+ // Attributes for amp-accordion, see <https://amp.dev/documentation/components/amp-accordion/#styling>.
+ if ( 'expanded' === $attribute_name ) {
+ if ( ! $this->has_used_tag_names( [ 'amp-accordion' ] ) ) {
+ return false;
+ }
+ continue;
+ }
+
if ( ! $this->used_attributes[ $attribute_name ] ) {
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment