diff --git a/includes/sanitizers/class-amp-img-sanitizer.php b/includes/sanitizers/class-amp-img-sanitizer.php index 4f4169b729d..45d4e3c9b3a 100644 --- a/includes/sanitizers/class-amp-img-sanitizer.php +++ b/includes/sanitizers/class-amp-img-sanitizer.php @@ -129,6 +129,10 @@ private function filter_attributes( $attributes ) { $out[ $name ] = $this->sanitize_dimension( $value, $name ); break; + case 'data-amp-layout': + $out['layout'] = $value; + break; + default: break; } diff --git a/tests/test-amp-img-sanitizer.php b/tests/test-amp-img-sanitizer.php index 557b9faa675..52889dd1097 100644 --- a/tests/test-amp-img-sanitizer.php +++ b/tests/test-amp-img-sanitizer.php @@ -12,42 +12,47 @@ public function setUp() { public function get_data() { return array( - 'no_images' => array( + 'no_images' => array( '
Lorem Ipsum Demet Delorit.
', 'Lorem Ipsum Demet Delorit.
', ), - 'image_without_src' => array( + 'image_without_src' => array( '', '', ), - 'image_with_empty_src' => array( + 'image_with_empty_src' => array( '', '', ), - 'image_with_self_closing_tag' => array( + 'image_with_layout' => array( + '', + '