Skip to content

each() iterates items in reverse order? #9

@Black-Platypus

Description

@Black-Platypus

When I try to use the each() function, I get all the elements in reverse order.
Using the following:

$htmlcode = "<div>
		<ul>
			<li class='dome'>first</li>
			<li class='dome'>second</li>
			<li>third</li>
			<li class='dome'>fourth</li>
			<li>fifth</li>
			<li class='dome'>sixth</li>
		</ul>
	</div>";
$H = new PowerTools\DOM_Query($htmlcode);
$l = $H->select("li.dome");
$l->each(function($i, $el){
	echo($i . ": " . $el);
});

I get:

3:
sixth
2:
fourth
1:
second
0:
first

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions