diff --git a/src/Sanitizer.php b/src/Sanitizer.php index 731b8c7..9fcab00 100644 --- a/src/Sanitizer.php +++ b/src/Sanitizer.php @@ -364,7 +364,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; @@ -399,7 +399,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))) {