Skip to content

Commit 1fb0f97

Browse files
committed
Get rid of more preg_match used for whitespace matching.
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401286
1 parent 5440419 commit 1fb0f97

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/HTML5/Tokenizer.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ private function beforeDoctypeNameState() {
14561456
/* Consume the next input character: */
14571457
$char = $this->c;
14581458

1459-
if(preg_match('/^[\t\n\x0a\x0c ]$/', $char)) {
1459+
if($char === "\t" || $char === "\n" || $char === "\x0c" || $char === ' ') {
14601460
/* U+0009 CHARACTER TABULATION
14611461
U+000A LINE FEED (LF)
14621462
U+000C FORM FEED (FF)
@@ -1631,7 +1631,7 @@ private function beforeDoctypePublicIdentifierState() {
16311631
/* Consume the next input character: */
16321632
$char = $this->c;
16331633

1634-
if (preg_match('/^[\t\n\x0c ]$/', $char)) {
1634+
if($char === "\t" || $char === "\n" || $char === "\x0c" || $char === ' ') {
16351635
/* U+0009 CHARACTER TABULATION
16361636
U+000A LINE FEED (LF)
16371637
U+000C FORM FEED (FF)
@@ -1740,7 +1740,7 @@ private function afterDoctypePublicIdentifierState() {
17401740
/* Consume the next input character: */
17411741
$char = $this->c;
17421742

1743-
if (preg_match('/^[\t\n\x0c ]$/', $char)) {
1743+
if($char === "\t" || $char === "\n" || $char === "\x0c" || $char === ' ') {
17441744
/* U+0009 CHARACTER TABULATION
17451745
U+000A LINE FEED (LF)
17461746
U+000C FORM FEED (FF)
@@ -1785,7 +1785,7 @@ private function beforeDoctypeSystemIdentifierState() {
17851785
/* Consume the next input character: */
17861786
$char = $this->c;
17871787

1788-
if (preg_match('/^[\t\n\x0c ]$/', $char)) {
1788+
if($char === "\t" || $char === "\n" || $char === "\x0c" || $char === ' ') {
17891789
/* U+0009 CHARACTER TABULATION
17901790
U+000A LINE FEED (LF)
17911791
U+000C FORM FEED (FF)
@@ -1894,7 +1894,7 @@ private function afterDoctypeSystemIdentifierState() {
18941894
/* Consume the next input character: */
18951895
$char = $this->c;
18961896

1897-
if (preg_match('/^[\t\n\x0c ]$/', $char)) {
1897+
if($char === "\t" || $char === "\n" || $char === "\x0c" || $char === ' ') {
18981898
/* U+0009 CHARACTER TABULATION
18991899
U+000A LINE FEED (LF)
19001900
U+000C FORM FEED (FF)

0 commit comments

Comments
 (0)