Removes all matched elements from the HTML source.

@param  string $css_selector The CSS selector used to get the desired elements.
@return integer Returns how many existing elements were deleted.
960847
public function delete($css_selector) {
		$xpath_selector	= $this->_css_toxpath_selector($css_selector);
		$nodelist		= $this->xpath->query($xpath_selector);
		if ($nodelist->item(0) === null) return 0;
		$counter = 0;
		foreach ($nodelist as $node) {
			$counter++;
			$node->parentNode->removeChild($node);
		}

		return $counter;
	}
891479
public function css($css)
    {
        if ($css === '') {
            return clone $this;
        }

        $query = $this->_document->getQuery();
        $nodes = [];
        foreach ($this->_nodes as $node) {
            /**
             * @var \DOMNode $node2
             */
            foreach ($query->css($css, $node) as $node2) {
                $nodes[$node2->getNodePath()] = $node2;
            }
        }

        return new SelectorList($this, array_values($nodes));
    }
1223738
public function strip($css)
    {
        /**
         * @var \DOMNode $node
         */
        foreach ($this->_document->getQuery()->css($css, $this->_node) as $node) {
            $node->parentNode->replaceChild(new \DOMText($node->textContent), $node);
        }

        return $this;
    }
175454
function(nodes) {
      if (nodes.length == 0) return nodes;
      var results = [], n;
      for (var i = 0, l = nodes.length; i < l; i++)
        if (!(n = nodes[i])._counted) {
          n._counted = true;
          results.push(Element.extend(n));
        }
      return Selector.handlers.unmark(results);
    }
363494
public function exists($css_selector) {
		$xpath_selector	= $this->_css_toxpath_selector($css_selector);
		$nodelist		= $this->xpath->query($xpath_selector);
		if ($nodelist->item(0) === null) return false;
		return true;
	}
927363
protected function selector(&$out) {
        $selector = array();

        while (true) {
            if ($this->match('[>+~]+', $m)) {
                $selector[] = array($m[0]);
            } elseif ($this->selectorSingle($part)) {
                $selector[] = $part;
                $this->whitespace();
            } else {
                break;
            }

        }

        if (count($selector) == 0) {
            return false;
        }

        $out = $selector;
        return true;
    }
612767
public function removeAll($elements)
    {
        if ($elements instanceof CollectionInterface) {
            $elements = $elements->toArray();
        }
        $this->elements = array_values(
            array_udiff(
                $this->elements,
                $elements,
                function ($a, $b) {
                    if ($a === $b) {
                        return 0;
                    } elseif (is_int($a) && is_object($b)) {
                        return -1;
                    } elseif (is_object($a) && is_int($b)) {
                        return 1;
                    } elseif ($a < $b) {
                        return -1;
                    } else {
                        return 1;
                    }
                }
            )
        );
        foreach ($this->subLists as $subList) {
            $subList->removeAll($elements, true);
        }
        return $this;
    }
299346
protected function _getElementByCss($sSelector)
    {
        $sSelector = str_replace('css=', '', $sSelector);
        $oElement = $this->getMinkSession()->getPage()->find('css', $sSelector);
        return $oElement;
    }
1068799
public function removeCssClass($cssClass)
    {
        if (array_key_exists($cssClass, $this->cssClasses)) {
            unset($this->cssClasses[$cssClass]);
        }
        return $this;
    }
1076341
public function countSelectors($css = null)
	{
		$count = 0;
		if ($css !== null && $this->css !== $css) {
			$this->css = $css;
			$this->parsedCss = $this->splitIntoBlocks($this->css);
		}
		foreach ($this->parsedCss as $rules) {
			$count += $rules['count'];
		}

		return $count;
	}
77059
public function setSelector($css_selector)
    {
        // if # is the first sign - we start with ID.
        if (0 === strpos($css_selector, '#')) {
            $css_selector .= '.'; // prevent empty second part.
            list($id, $class) = explode('.', $css_selector, 2);
        } else {
            $css_selector .= '#'; // prevent empty second part.
            list($class, $id) = explode('#', $css_selector, 2);
        }

        $id = trim($id, '#');
        $class = trim($class, '.');

        if (! empty($id)) {
            $this->setAttr('id', $id);
        }

        if (! empty($class)) {
            $class = str_replace('.', ' ', $class);
            $this->setAttr('class', $class);
        }

        return $this;
    }
176129
function removeFromArray(arr, selector) {
        var idx = arr.indexOf(selector);
        if (idx !== -1) {
            return arr.splice(idx, 1);
        }
        return false;
    }
1257963
protected function imageColor($image, string $css_color): int
    {
        return imagecolorallocate(
            $image,
            (int) hexdec(substr($css_color, 0, 2)),
            (int) hexdec(substr($css_color, 2, 2)),
            (int) hexdec(substr($css_color, 4, 2))
        );
    }
610328
function(selector) {
    for (var ii = 0; ii < document.styleSheets.length; ++ii) {
      var styleSheet = document.styleSheets[ii];
      var rules = styleSheet.cssRules || styleSheet.rules;
      if (rules) {
        for (var rr = 0; rr < rules.length; ++rr) {
          var rule = rules[rr];
          if (rule.selectorText === selector) {
            return rule;
          }
        }
      }
    }
  }
1207191
private function _specificity($selector, $origin = self::ORIG_AUTHOR)
    {
        // http://www.w3.org/TR/CSS21/cascade.html#specificity
        // ignoring the ":" pseudoclass modifiers
        // also ignored in _css_selector_to_xpath

        $a = ($selector === "!attr") ? 1 : 0;

        $b = min(mb_substr_count($selector, "#"), 255);

        $c = min(mb_substr_count($selector, ".") +
            mb_substr_count($selector, "["), 255);

        $d = min(mb_substr_count($selector, " ") +
            mb_substr_count($selector, ">") +
            mb_substr_count($selector, "+"), 255);

        //If a normal element name is at the beginning of the string,
        //a leading whitespace might have been removed on whitespace collapsing and removal
        //therefore there might be one whitespace less as selected element names
        //this can lead to a too small specificity
        //see _css_selector_to_xpath

        if (!in_array($selector[0], array(" ", ">", ".", "#", "+", ":", "[")) && $selector !== "*") {
            $d++;
        }

        if ($this->_dompdf->getOptions()->getDebugCss()) {
            /*DEBUGCSS*/
            print "<pre>\n";
            /*DEBUGCSS*/
            printf("_specificity(): 0x%08x \"%s\"\n", self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d)), $selector);
            /*DEBUGCSS*/
            print "</pre>";
        }

        return self::$_stylesheet_origins[$origin] + (($a << 24) | ($b << 16) | ($c << 8) | ($d));
    }
818402
public function remove()
    {

        $reflection = new \ReflectionClass( get_called_class() );
        $removing = $reflection->newInstanceArgs( func_get_args() );

        reset( $this->intervals );
        reset( $removing->intervals );

        list(,$remove) = each($removing->intervals);
        list(,$current) = each($this->intervals);

        $output = array();

        $c = 0;
        while( $remove and $current and $c++ < 100 ) {

            // Intervals don't yet overlap in any way. Current lags remove.
            //       |---|  // remove
            // |---|        // current
            if( $remove[0] !== null and $this->sort( $remove[0], $current[1], self::NULL_IS_HIGH ) > 0 ) {

                $output[] = $current;
                list(,$current) = each($this->intervals);
                continue;

            }

            // Intervals don't yet overlap in any way. Remove lags current.
            //  |---|       // remove
            //        |---| // current
            if( $current[0] !== null and $this->sort( $current[0], $remove[1], self::NULL_IS_HIGH ) > 0 ) {
                list(,$remove) = each($removing->intervals);
                continue;
            }

            // lower check
            $lowerBoundOverlap = $this->sort( $remove[0], $current[0], self::NULL_IS_LOW );

            // upper check
            $upperBoundOverlap = $this->sort( $current[1], $remove[1], self::NULL_IS_HIGH );

            // is current completely contained in remove
            if( $lowerBoundOverlap <= 0 and $upperBoundOverlap <= 0 ) {
                list(,$current) = each($this->intervals);
                continue;
            }

//            print_r_pre( ":0:\n", $current, $remove );

            // remove is completely contained in current, we're splitting into two halves
            if( $lowerBoundOverlap === 1 and $upperBoundOverlap === 1 ) {

                $remove = array(
                    $this->nextLowestValue( $remove[0] ),
                    $this->nextHighestValue( $remove[1] )
                );

                if( $remove[0] !== $remove[1] ) {

                    // lower interval
                    $output[] = array(
                        $current[0],
                        $remove[0]
                    );

                    $current[0] = $remove[1];

                }

                list(,$remove) = each($removing->intervals);

//                print_r_pre( ":1:\n", $current, $remove );

            // remove's upper bound is <= current upperbound and lower bound is completely covered
            } elseif( $upperBoundOverlap === 1 ) {

                $current[0] = $this->nextHighestValue( $remove[1] );

                list(,$remove) = each($removing->intervals);

//                print_r_pre( ":2:\n", $current, $remove );

            // remove's upperbound is >= current upperbound and lower bound is free
            } elseif( $lowerBoundOverlap === 1 ) {

                // lower interval
                $output[] = array(
                    $current[0],
                    $this->nextLowestValue( $remove[0] )
                );
                list(,$current) = each($this->intervals);

//                print_r_pre( ":3:\n", $current, $remove );

            // this shouldn't happen
            } else {

                throw new \RuntimeException("this state hasn't been accounted for - this should never happen");

            }

        }

        if( $current ) {
            $output[] = $current;
        }

        // add in any remaining intervals not yet added
        while( list(,$current) = each($this->intervals) ) {
            $output[] = $current;
        }

        $this->intervals = $output;
        return $this;

    }
939291
protected function _getFromCSS()
    {
        // styles to apply
        $styles = array();

        // list of the selectors to get in the CSS files
        $getit  = array();

        // get the list of the selectors of each tags
        $lst = array();
        $lst[] = $this->value['id_lst'];
        for ($i=count($this->table)-1; $i>=0; $i--) {
            $lst[] = $this->table[$i]['id_lst'];
        }

        // foreach selectors in the CSS files, verify if it match with the list of selectors
        foreach ($this->cssKeys as $key => $num) {
            if ($this->_getReccursiveStyle($key, $lst)) {
                $getit[$key] = $num;
            }
        }

        // if we have selectors
        if (count($getit)) {
            // get them, but in the definition order, because of priority
            asort($getit);
            foreach ($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]);
        }

        return $styles;
    }