diff options
author | Matt Butcher <[email protected]> | 2014-12-01 19:51:14 -0700 |
---|---|---|
committer | Matt Butcher <[email protected]> | 2014-12-01 19:51:14 -0700 |
commit | b39dd885966dea2d3d33509af505f4ecef2f6343 (patch) | |
tree | cbc6e371a1bd9efc53151b349c7ea6dd8b26bb94 | |
parent | f50e87904ed0857ea2dead2ae4facf7d95c743fd (diff) | |
parent | c1581031d404574a32c4cb1aa72f59f0f5f74250 (diff) |
Merge pull request #66 from Masterminds/dash
Added support for dashes in element tag names (closes #65)
-rw-r--r-- | src/HTML5/Parser/Tokenizer.php | 2 | ||||
-rw-r--r-- | test/HTML5/Html5Test.php | 6 | ||||
-rw-r--r-- | test/HTML5/Parser/TokenizerTest.php | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/HTML5/Parser/Tokenizer.php b/src/HTML5/Parser/Tokenizer.php index 92510de..f7b450f 100644 --- a/src/HTML5/Parser/Tokenizer.php +++ b/src/HTML5/Parser/Tokenizer.php @@ -353,7 +353,7 @@ class Tokenizer } // We know this is at least one char. - $name = strtolower($this->scanner->charsWhile(":0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + $name = strtolower($this->scanner->charsWhile(":_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); $attributes = array(); $selfClose = false; diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php index 2b46b23..0ab367c 100644 --- a/test/HTML5/Html5Test.php +++ b/test/HTML5/Html5Test.php @@ -259,6 +259,12 @@ class Html5Test extends TestCase $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); diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php index bf04c58..8ff4d5c 100644 --- a/test/HTML5/Parser/TokenizerTest.php +++ b/test/HTML5/Parser/TokenizerTest.php @@ -557,7 +557,6 @@ class TokenizerTest extends \Masterminds\HTML5\Tests\TestCase '<static*all>' => 'static', '<h*0720/>' => 'h', '<st*ATTRIBUTE />' => 'st', - '<a-href="http://url.com/">' => 'a' ); foreach ($cases as $html => $expected) { |