Skip to content

Commit

Permalink
Merge pull request #66 from Masterminds/dash
Browse files Browse the repository at this point in the history
Added support for dashes in element tag names (closes #65)
  • Loading branch information
technosophos committed Dec 2, 2014
2 parents f50e879 + c158103 commit b39dd88
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/HTML5/Parser/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ protected function tagName()
}

// We know this is at least one char.
$name = strtolower($this->scanner->charsWhile(":0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
$name = strtolower($this->scanner->charsWhile(":_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
$attributes = array();
$selfClose = false;

Expand Down
6 changes: 6 additions & 0 deletions test/HTML5/Html5Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ public function testElements()
$res = $this->cycleFragment('<span></span>');
$this->assertRegExp('|<span></span>|', $res);

// Elements with dashes and underscores
$res = $this->cycleFragment('<sp-an></sp-an>');
$this->assertRegExp('|<sp-an></sp-an>|', $res);
$res = $this->cycleFragment('<sp_an></sp_an>');
$this->assertRegExp('|<sp_an></sp_an>|', $res);

// Should have no closing tag.
$res = $this->cycle('<hr>');
$this->assertRegExp('|<hr></body>|', $res);
Expand Down
1 change: 0 additions & 1 deletion test/HTML5/Parser/TokenizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,6 @@ public function testIllegalTagNames()
'<static*all>' => 'static',
'<h*0720/>' => 'h',
'<st*ATTRIBUTE />' => 'st',
'<a-href="http://url.com/">' => 'a'
);

foreach ($cases as $html => $expected) {
Expand Down

0 comments on commit b39dd88

Please sign in to comment.