diff --git a/src/AmpUtils/Sanitizers/FacebookSanitizer.php b/src/AmpUtils/Sanitizers/FacebookSanitizer.php index 13f5b49..8b01c4b 100644 --- a/src/AmpUtils/Sanitizers/FacebookSanitizer.php +++ b/src/AmpUtils/Sanitizers/FacebookSanitizer.php @@ -134,7 +134,7 @@ private function create_amp_facebook_and_replace_node( $node, $embed_type ) { 'height' => $node->hasAttribute( 'data-height' ) ? $node->getAttribute( 'data-height' ) : $this->args['height'], ]; - if ( '100%' === $attributes['width'] || 'auto' === $attributes['width'] ) { + if ( '100%' === $attributes['width'] || 'auto' === $attributes['width'] || '' === $attributes['width'] ) { $attributes['layout'] = 'fixed-height'; $attributes['width'] = 'auto'; } diff --git a/tests/Feature/AmpSanitizerTest.php b/tests/Feature/AmpSanitizerTest.php index bffdd31..00b0f37 100644 --- a/tests/Feature/AmpSanitizerTest.php +++ b/tests/Feature/AmpSanitizerTest.php @@ -89,6 +89,16 @@ public function testFbVideoAuto() $this->assertEquals('', $amp_content); } + /** + * @group fb_test + */ + public function testFbVideoNoWidth() + { + $amp_content = Amped::convert('
'); + + $this->assertEquals('', $amp_content); + } + /** * @group fb_test */