Merge branch 'master' of github.com:jae-jae/QueryList into develop
This commit is contained in:
commit
52bbdeae14
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user