Skip to content

Commit

Permalink
Make tag names case-insensitive in HTML mode
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishow committed Jan 4, 2024
1 parent c0a0667 commit deac808
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ protected function convertSingleSelector(string $css):string {
switch ($currentThreadItem["type"]) {
case "star":
case "element":
$xpath []= $currentThreadItem['content'];
if($this->htmlMode) {
$xpath []= strtolower($currentThreadItem['content']);
} else {
$xpath []= $currentThreadItem['content'];
}
$hasElement = true;
break;

Expand Down
8 changes: 8 additions & 0 deletions test/phpunit/TranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ public function testCaseSensitivityHtmlMode() {
0,
$xpath->query($attributeValueCaseSensitive)->length
);

$tagNameCaseInsensitive = new Translator(
"dIv"
);
self::assertEquals(
1,
$xpath->query($tagNameCaseInsensitive)->length
);

}

Expand Down

0 comments on commit deac808

Please sign in to comment.