diff --git a/src/Dom/Document.php b/src/Dom/Document.php index d65870279a8..63afce82c97 100644 --- a/src/Dom/Document.php +++ b/src/Dom/Document.php @@ -379,7 +379,7 @@ private function normalize_document_structure( $content ) { if ( ! preg_match( self::HTML_STRUCTURE_BODY_END_TAG, $content, $matches ) ) { // Only missing. // @todo This is an expensive regex operation, look into further optimization. - $content = preg_replace( self::HTML_STRUCTURE_HEAD_TAG, '$0', $content, 1 ); + $content = preg_replace( self::HTML_STRUCTURE_HEAD_TAG, '$0', $content, 1 ); $content .= ''; } } diff --git a/tests/php/test-class-amp-dom-document.php b/tests/php/test-class-amp-dom-document.php index 2aaca141feb..ac04a9cd6f8 100644 --- a/tests/php/test-class-amp-dom-document.php +++ b/tests/php/test-class-amp-dom-document.php @@ -172,8 +172,8 @@ public function assertEqualMarkup( $expected, $actual ) { * @covers \Amp\AmpWP\Dom\Document::convert_amp_bind_attributes() */ public function test_amp_bind_conversion() { - $original = ''; - $dom = new Document(); + $original = ''; + $dom = new Document(); $dom->loadHTML( $original ); $converted = $dom->saveHTML(); $this->assertNotEquals( $original, $converted ); @@ -181,15 +181,15 @@ public function test_amp_bind_conversion() { $this->assertContains( 'width="300" height="200" data-foo="bar" selected', $converted ); // Check tag with self-closing attribute. - $original = ''; - $dom = new Document(); + $original = ''; + $dom = new Document(); $dom->loadHTML( $original ); $converted = $dom->saveHTML(); $this->assertNotEquals( $original, $converted ); // Preserve trailing slash that is actually the attribute value. $original = 'Home'; - $dom = new Document(); + $dom = new Document(); $dom->loadHTML( $original ); $converted = $dom->saveHTML( $dom->body->firstChild ); $this->assertEquals( 'Home', $converted );