Is selector (at a media) exists

@param   string      $selector
@param   string      $media
@param   int|null    $rootId
@param   int|null    $excludeId
@return  bool
499818
public function isSelectorExists( $selector,
                                      $media        = '',
                                      $rootId       = null,
                                      $excludeId    = null )
    {
        $where = array(
            'selector'  => (string) $selector,
            'media'     => (string) $media,
        );

        if ( empty( $rootId ) )
        {
            $where[] = new Predicate\IsNull( 'rootParagraphId' );
        }
        else
        {
            $where['rootParagraphId'] = (int) $rootId;
        }

        if ( ! empty( $excludeId ) )
        {
            $where[] = new Predicate\Operator(
                'id',
                Predicate\Operator::OP_NE,
                $excludeId
            );
        }

        return $this->isExists( $where );
    }
1220854
public function findElement($strategy, $selector)
	{
		$this->modifyCriteria($strategy, $selector);
		return $this->getRoot()->findElement($strategy, $selector);
	}
399804
function(selector) {
        var el = this.el.querySelector(selector);
        if (el && el.parentElement !== this.el) {
            el = null;
        }
        return el;
    }
1213873
public function isSubdomainUriExists( $subdomainId, $uri, $excludeUriId = null )
    {
        return $this->isExists( empty( $excludeUriId ) ? array(
            'subdomainId'   => $subdomainId,
            'uri'           => $uri,
        ) : array(
            'subdomainId'   => $subdomainId,
            'uri'           => $uri,
            new Predicate\Operator(
                'id',
                Predicate\Operator::OP_NE,
                $excludeUriId
            ),
        ) );
    }
775742
public function filter($selector)
    {
        $converter = $this->createCssSelectorConverter();

        // The CssSelector already prefixes the selector with descendant-or-self::
        return $this->filterRelativeXPath($converter->toXPath($selector));
    }
656603
protected function is_special_selector($type = null, $selector = null)
    {
        $selector = Phery::coalesce($selector, $this->last_selector);

        if ($selector && preg_match('/\{([\D]+)\d+\}/', $selector, $matches)) {
            if ($type === null) {
                return true;
            }

            return ($matches[1] === $type);
        }

        return false;
    }
1119612
public function find(string $selector, int $nth = null)
    {
        $this->isLoaded();

        return $this->root->find($selector, $nth);
    }
1023692
void add( LessExtend lessExtend, String[] mainSelector ) {
        if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) {
            mainSelector = lessExtend.getSelectors();
        } else {
            mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() );
        }
        String extendingSelector = lessExtend.getExtendingSelector();
        if( lessExtend.isAll() ) {
            LessExtendResult extend = new LessExtendResult( mainSelector, extendingSelector );
            SelectorTokenizer tokenizer = tokenizers.pollLast().init( extendingSelector );
            do {
                String token = tokenizer.next();
                if( token == null ) {
                    break;
                }
                all.add( token, extend );
            } while( true );
            tokenizers.addLast( tokenizer );
        } else {
            exact.add( extendingSelector, mainSelector );
        }
    }
1051127
public function find($selector, $idx = null)
    {
        $elements = new self();
        foreach ($this as $node) {
            foreach ($node->find($selector) as $res) {
                $elements->append($res);
            }
        }
        if (null === $idx) {
            return $elements;
        }

        if ($idx < 0) {
            $idx = count($elements) + $idx;
        }

        return isset($elements[$idx]) ? $elements[$idx] : null;
    }
802120
public function query($selector, \DOMNode $context = null)
    {
        $this->enableRestoreInternal(true);

        if ($this->selector === null) {
            $this->selector = new Selector($this);
        }

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

        $this->raise($this->exceptionlevel);

        $this->enableRestoreInternal(false);

        return $nodes;
    }
1203789
public static function register( $selectors, $properties, $media_query = null ) {
		if ( ! is_array( $selectors ) ) {
			$selectors = explode( ',', $selectors );
		}

		if ( ! is_array( $properties ) ) {
			$properties = explode( ';', $properties );
		}

		static::$styles[] = [
			'selectors'   => $selectors,
			'properties'  => $properties,
			'media_query' => $media_query,
		];
	}
1246321
public function remove($selector=null)
    {
        $result = $this;
        if ($selector) {
            $result = $result->filter($selector);
        }
        foreach ($result->nodes as $node) {
            if ($node->parentNode) {
                $node->parentNode->removeChild($node);
            }
        }

        $result->nodes = array();
        $result->length = 0;

        return $result;
    }
830592
public function querySelector(string $selectors): ?\DOMElement
    {
        $crawler = $this->getCrawler();

        $filteredCrawler = $crawler->filter($selectors);

        if (0 === $filteredCrawler->count()) {
            return null;
        }

        return $filteredCrawler->getNode(0);
    }
119416
function (selector) {
            var self = this, all = self.all(selector), ret = all.length ? all.slice(0, 1) : null;
            if (ret) {
                ret.__parent = self;
            }
            return ret;
        }
893206
public function findElements($strategy, $selector)
	{
		$this->modifyCriteria($strategy, $selector);
		return $this->getRoot()->findElements($strategy, $selector);
	}
1357806
public function find($selector, $idx=null, $lowercase=false)
	{
		return $this->root->find($selector, $idx, $lowercase);
	}
156579
function(selector, context) {
  this.selector = selector;
  if (typeof context == 'function') {
    this.context = null;
    this.asyncExecute(null, null, context);
  }
  else {
    this.context = context;
  }

  this.instance = -1;
  this.index = -1;
  this.length = -1;
}