Skip to content
Thomas Weinert edited this page Jul 12, 2018 · 2 revisions

FluentDOM\Query::is()

FluentDOM\Query is(string $selector);

Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.

Usage

$html = <<<HTML
<html>
  <head>
    <title>Examples: FluentDOM\Query::is()</title>
  </head>
  <body>
    <form><input type="checkbox" /></form>
    <div> </div>
  </body>
</html>
HTML;

$fdQuery = FluentDOM($html, 'text/html');
var_dump(
  $fdQuery
    ->find('//input[@type = "checkbox"]')
    ->parent()
    ->is('name() = "form"')
);

Output

bool(true)
Clone this wiki locally