You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Huh...
I just had a look at the object, the nodes are actually in the correct order. The each method must be effing something up.
Doing $l->nodes = array_reverse($l->nodes); before the each call gives the correct order.
Yep, for some reason, each is implemented like this:
public function _each($function) {
$select = $this->select($this->nodes);
for ($i = count($select->nodes) - 1; $i > -1; $i--) {
$function($i, $this->select($select->nodes[$i]));
}
return $select;
}
where it should be implemented like this:
public function _each($function) {
$select = $this->select($this->nodes);
for ($i = 0; $i < count($select->nodes); $i++) {
$function($i, $this->select($select->nodes[$i]));
}
return $select;
}
If this is to ensure smooth sailing even if you remove nodes (thus change the following indices), the better way would be to work on a shadow object, IMO
When I try to use the each() function, I get all the elements in reverse order.
Using the following:
I get:
What's up with that?
I feel like I shouldn't have to write my own wrapper to make this go from top to bottom.
Am I missing something?
The text was updated successfully, but these errors were encountered: