find and remove dom node by css selector
@param string $selector
@param string $idx
@param array $excludes
@return array
349594
function findAndRemove($selector, $idx = null ,$excludes = array())
    {
        if (empty($excludes)) return $this->find($selector,$idx);

        foreach ($excludes as $exclude) {
            foreach ($this->find($exclude) as $node) {
                $node->outertext = '';
            }
        }
        $this->load($this->save());
        return $this->find($selector,$idx);
    }
725061
public function remove($selector, $name = true, $options = null)
    {
        if (!array_key_exists($selector, $this->rules)) {
            return $this;
        }
        /* @var $collection \Sirius\Validation\ValueValidator */
        $collection = $this->rules[$selector];
        $collection->remove($name, $options);

        return $this;
    }
33190
public function first($selector, \DOMNode $context = null)
    {
        $this->exceptionlevel = 4;

        $nodes = $this->query($selector, $context);

        $this->exceptionlevel = 3;

        $node = $nodes->length ? $nodes->item(0) : null;

        $nodes = null;

        return $node;
    }
1204234
public function find($selector, $idx = NULL) {
		if (empty($this->node->childNodes)) {
			return FALSE;
		}
		$selectors = $this->parse_selector($selector);
		if (($count = count($selectors)) === 0) {
			return FALSE;
		}
		for ($c = 0; $c < $count; $c++) {
			if (($level = count($selectors [$c])) === 0) {
				return FALSE;
			}
			$this->search($this->node, $idx, $selectors [$c], $level);
		}
		$found = $this->_lFind;
		$this->_lFind = [];
		if ($idx !== NULL) {
			if ($idx < 0) {
				$idx = count($found) + $idx;
			}
			if (isset($found[$idx])) {
				return $found[$idx];
			} else {
				return FALSE;
			}
		}
		return $found;
	}
387457
private function getNodesToExclude(\DOMXPath $xPath)
    {
        $excludedNodes = [];
        foreach (array_keys($this->excludedSelectors) as $selectorToExclude) {
            try {
                $matchingNodes = $xPath->query($this->translateCssToXpath($selectorToExclude));
            } catch (\InvalidArgumentException $e) {
                if ($this->debug) {
                    throw $e;
                }
                continue;
            }
            foreach ($matchingNodes as $node) {
                $excludedNodes[] = $node;
            }
        }

        return $excludedNodes;
    }
775742
public function filter($selector)
    {
        $converter = $this->createCssSelectorConverter();

        // The CssSelector already prefixes the selector with descendant-or-self::
        return $this->filterRelativeXPath($converter->toXPath($selector));
    }
1276215
function ( selector ) {
            var el = this.element(),
                children = el.children;
    
            if ( typeof selector === 'string' ) {
                var elNum = children.length, result = [], i;
    
                for ( i = 0; i < elNum; ++i ) {
                    var child = children[i],
                        match = $B.selector.match( child, selector );
    
                    if ( match ) result.push( child );
                }
                return result;
            } else {
                //this.element().childNodes;
                return $B( children ).toArray();
            }
        }
554113
public SelectorList parseSelectors(final String selectors) throws IOException {
        try (InputSource source = new InputSource(new StringReader(selectors))) {
            final HandlerBase handler = new HandlerBase();
            parser_.setDocumentHandler(handler);
            return parser_.parseSelectors(source);
        }
    }
540002
def remove_elements(self, selector, by=By.CSS_SELECTOR):
        
        selector, by = self.__recalculate_selector(selector, by)
        selector = self.convert_to_css_selector(selector, by=by)
        remove_script = """jQuery('%s').remove()""" % selector
        self.safe_execute_script(remove_script)
520761
private function get_excluded_tags($exclude)
	{
		$ret = array();

		foreach($this->bbcodes as $bbcode)
			if($bbcode->auto_detect_exclude() & $exclude)
				$ret[] = $bbcode->tag();

		return $ret;
	}
252657
public function filter($selector)
    {
        if (!class_exists('Symfony\\Component\\CssSelector\\CssSelectorConverter')) {
            throw new \RuntimeException('Unable to filter with a CSS selector as the Symfony CssSelector 2.8+ is not installed (you can use filterXPath instead).');
        }

        $converter = new CssSelectorConverter($this->isHtml);

        // The CssSelector already prefixes the selector with descendant-or-self::
        return $this->filterRelativeXPath($converter->toXPath($selector));
    }
934215
function appendElementSelector (element, selector) {
  const processor = selectorParser((selectors) => {
    let combinatorNode = null

    /**
     * looping breaks if we insert dynamically
     */
    selectors.each((selector) => {
      const elementNode = selectorParser.tag({ value: element.tag })
      selector.walk((node) => {
        if (node.type === 'combinator') { combinatorNode = node }
      })

      if (combinatorNode) {
        selector.insertAfter(combinatorNode, elementNode)
      } else {
        selector.prepend(elementNode)
      }
    })
  })

  return processor.process(selector).result
}
1035080
protected function compileSelectors($selectors)
    {
        $out = array();

        foreach ($selectors as $s) {
            if (is_array($s)) {
                list(, $value) = $s;
                $out[] = $this->compileValue($this->reduce($value));
            } else {
                $out[] = $s;
            }
        }

        return $out;
    }
1227350
protected static function handle_nested_selectors ($selector, $data) {
		/**
		 * If tag name ends with pipe "|" symbol - for every element of array separate copy of current tag will be created
		 */
		if (substr($selector[0], -1) == '|') {
			$selector[0] = substr($selector[0], 0, -1);
			$output      = [];
			/**
			 * When parameters are not taken in braces - make this operation, if it is necessary
			 */
			if (
				count($data) > 2 ||
				(
					isset($data[1]) &&
					static::is_array_indexed($data[1])
				)
			) {
				$data = [$data];
			}
			foreach ($data[0] as $d) {
				if (isset($d[0]) && static::is_array_indexed($d[0])) {
					if (
						isset($d[1]) &&
						(
							!is_array($d[1]) ||
							static::is_array_indexed($d[1])
						)
					) {
						$output[] = static::render_array_of_elements($selector[1], $d);
					} else {
						$output[] = [
							static::__callStatic($selector[1], $d[0]),
							isset($d[1]) ? $d[1] : false
						];
					}
				} else {
					$output[] = static::__callStatic($selector[1], $d);
				}
			}
		} elseif (!isset($data[1]) || static::is_array_assoc($data[1])) {
			$output  = static::__callStatic(
				$selector[1],
				[
					isset($data[0]) ? $data[0] : '',
					isset($data[1]) ? $data[1] : false
				]
			);
			$data[1] = [];
		} else {
			$output  = static::__callStatic($selector[1], $data);
			$data[1] = [];
		}
		return static::__callStatic_internal(
			$selector[0],
			[
				$output,
				isset($data[1]) ? $data[1] : false
			]
		);
	}
212536
public function remove_selector($selector)
    {
        if ((is_string($selector) || is_int($selector)) && isset($this->data[$selector])) {
            unset($this->data[$selector]);
        }

        return $this;
    }
372073
protected static function render_array_of_elements ($selector, $data) {
		$output = '';
		foreach ($data as $d) {
			$output .= static::__callStatic($selector, $d);
		}
		return $output;
	}
949652
public function filter($selector)
    {
        $result = $this->createChildInstance();

        if ($this->length > 0) {
            if (\is_callable($selector)) {
                foreach ($this->nodes as $index => $node) {
                    if ($selector($node, $index)) {
                        $result->addDomNode($node);
                    }
                }
            } else {
                $selection = self::create($this->document)->find($selector);

                foreach ($selection as $result_node) {
                    foreach ($this->nodes as $node) {
                        if ($result_node->isSameNode($node)) {
                            $result->addDomNode($node);
                            break 1;
                        }
                    }
                }
            }
        }

        return $result;
    }