Redaxscript\Filter\Html::_stripAttributes PHP Method

_stripAttributes() protected method

strip the attributes
Since: 2.4.0
protected _stripAttributes ( object $node = null ) : object
$node object target node
return object
    protected function _stripAttributes($node = null)
    {
        foreach ($node->childNodes as $childNode) {
            if ($childNode->nodeType === XML_ELEMENT_NODE) {
                foreach ($childNode->attributes as $attributeName => $attributeNode) {
                    if (!in_array($attributeName, $this->_allowedAttributes)) {
                        $childNode->removeAttribute($attributeName);
                    }
                }
                /* strip children attributes */
                if ($childNode->hasChildNodes()) {
                    $this->_stripAttributes($childNode);
                }
            }
        }
        return $node;
    }