Skip to content

Commit

Permalink
Merge pull request #43 from cidilabs/PHPALLY-dont-flag-nbsp
Browse files Browse the repository at this point in the history
Don't flag NBSP in text emphasis check
  • Loading branch information
atarisafari authored Dec 14, 2022
2 parents e3754a3 + 4650e26 commit 04ca1ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Rule/CssTextStyleEmphasize.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public function check()
continue;
}

// skip if the element only contains whitespace
if(!$elementText) {
continue;
}

// skip if parent text == element text AND parent element is emphasized
$parentNode = $element->parentNode;
if ($parentNode && ($parentNode->nodeType === XML_ELEMENT_NODE)) {
Expand Down
3 changes: 3 additions & 0 deletions tests/CssTextStyleEmphasizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ protected function getValidTestHtml()
// emphasis tag w/ color
"valid colored {emphasis_tag}" => "<{block_tag}><{emphasis_tag} style='color: red'>COLORED EMPHASIS</{emphasis_tag}>.</{block_tag}>",
"valid bgcolor {emphasis_tag}" => "<{block_tag}><{emphasis_tag} style='background-color: red;'>BG COLORED EMPHASIS</{emphasis_tag}>.</{block_tag}>",

// &nbsp;
"valid {block_tag}, bgcolor {generic_tag}" => "<{block_tag}><{generic_tag} style='background-color: red;'>&nbsp;&nbsp;&nbsp;</{generic_tag}></{block_tag}>",
];
}

Expand Down

0 comments on commit 04ca1ad

Please sign in to comment.