AMP_Img_Sanitizer::adjust_and_replace_node PHP Method

adjust_and_replace_node() private method

Make final modifications to DOMNode
private adjust_and_replace_node ( DOMNode $node )
$node DOMNode The DOMNode to adjust and replace
    private function adjust_and_replace_node($node)
    {
        $old_attributes = AMP_DOM_Utils::get_node_attributes_as_assoc_array($node);
        $new_attributes = $this->filter_attributes($old_attributes);
        $new_attributes = $this->enforce_sizes_attribute($new_attributes);
        if ($this->is_gif_url($new_attributes['src'])) {
            $this->did_convert_elements = true;
            $new_tag = 'amp-anim';
        } else {
            $new_tag = 'amp-img';
        }
        $new_node = AMP_DOM_Utils::create_node($this->dom, $new_tag, $new_attributes);
        $node->parentNode->replaceChild($new_node, $node);
    }