Merge branch 'master' of github.com:jae-jae/QueryList into develop

This commit is contained in:
Jaeger 2020-03-15 14:07:52 +08:00
commit 52bbdeae14

View File

@ -166,6 +166,34 @@ class Elements
return $obj;
}
/**
* Iterating elements
*
* @param callable $callback
*
* @return $this
*/
public function each(callable $callback)
{
$break = false;
$this->elements->each(function ($dom) use ($callback, &$break) {
if ( ! $dom || $break) {
return;
}
$orig = $dom;
$dom = new Elements(pq($dom));
if (false === call_user_func($callback, $dom)) {
$dom = $orig;
$break = true;
} else {
$dom = $dom->getDOMDocument();
}
unset($orig);
});
return $this;
}
/**
* Iterating elements
*
@ -184,7 +212,7 @@ class Elements
/**
* Gets the attributes of all the elements
*
* @param $attr HTML attribute name
* @param string $attr HTML attribute name
* @return \Illuminate\Support\Collection|\Tightenco\Collect\Support\Collection
*/
public function attrs($attr)