Skip to content

Commit

Permalink
Merge pull request #102 from igor-krein/using-qualified-node-names
Browse files Browse the repository at this point in the history
using qualified node names
  • Loading branch information
darylldoyle authored Jun 18, 2024
2 parents 6a2c069 + 436e592 commit f9460a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ protected function startClean(\DOMNodeList $elements, array $elementsToRemove)
$breaksOutOfForeignContent = false;
for ($x = $currentElement->attributes->length - 1; $x >= 0; $x--) {
// get attribute name
$attrName = $currentElement->attributes->item( $x )->name;
$attrName = $currentElement->attributes->item( $x )->nodeName;

if (in_array(strtolower($attrName), ['face', 'color', 'size'])) {
$breaksOutOfForeignContent = true;
Expand Down Expand Up @@ -398,7 +398,7 @@ protected function cleanAttributesOnWhitelist(\DOMElement $element)
{
for ($x = $element->attributes->length - 1; $x >= 0; $x--) {
// get attribute name
$attrName = $element->attributes->item($x)->name;
$attrName = $element->attributes->item($x)->nodeName;

// Remove attribute if not in whitelist
if (!in_array(strtolower($attrName), $this->allowedAttrs) && !$this->isAriaAttribute(strtolower($attrName)) && !$this->isDataAttribute(strtolower($attrName))) {
Expand Down

0 comments on commit f9460a4

Please sign in to comment.