Skip to content

Commit

Permalink
Merge 9bc35db into 9663472
Browse files Browse the repository at this point in the history
  • Loading branch information
parisholley committed May 19, 2016
2 parents 9663472 + 9bc35db commit 98873a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PHPHtmlParser/Dom.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,8 +516,8 @@ protected function parseTag()
}

if (empty($name)) {
$this->content->fastForward(1);
continue;
$this->content->skipByToken('blank');
continue;
}

$this->content->skipByToken('blank');
Expand Down
9 changes: 9 additions & 0 deletions tests/DomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ public function testLoadUtf8()
$this->assertEquals('Dzień', $dom->find('p', 0)->text);
}

public function testLoadFileWhitespace()
{
$dom = new Dom;
$dom->setOptions(['cleanupInput' => false]);
$dom->loadFromFile('tests/files/whitespace.html');
$this->assertEquals(1, count($dom->find('.class')));
$this->assertEquals("<span><span class=\"class\"></span></span>", (string)$dom);
}

public function testLoadFileBig()
{
$dom = new Dom;
Expand Down
1 change: 1 addition & 0 deletions tests/files/whitespace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span><span class="class" ></span></span>

0 comments on commit 98873a4

Please sign in to comment.