You are here

public function BlazyFilter::cleanupNodes in Blazy 8.2

Same name and namespace in other branches
  1. 7 src/Plugin/Filter/BlazyFilter.php \Drupal\blazy\Plugin\Filter\BlazyFilter::cleanupNodes()

Cleanups invalid nodes or those of which their contents are moved.

Parameters

\DOMDocument $dom: The HTML DOM object being modified.

Overrides BlazyFilterInterface::cleanupNodes

1 call to BlazyFilter::cleanupNodes()
BlazyFilter::process in src/Plugin/Filter/BlazyFilter.php
Performs the filter processing.

File

src/Plugin/Filter/BlazyFilter.php, line 260

Class

BlazyFilter
Provides a filter to lazyload image, or iframe elements.

Namespace

Drupal\blazy\Plugin\Filter

Code

public function cleanupNodes(\DOMDocument &$dom) {
  $xpath = new \DOMXPath($dom);
  $nodes = $xpath
    ->query("//*[contains(@class, 'blazy-removed')]");
  if ($nodes->length > 0) {
    $this
      ->removeNodes($nodes);
  }
}