Skip to content

Closest only returns result for the first matched element #61

Closed
@musabhusaini

Description

@musabhusaini

I am trying to apply the Closest selector method to a set of matched elements and expecting to get one closest ancestor per matched element (in cases where such an ancestor exists), but only the first one is getting matched.

Assuming document is a valid CQ document object, I am making a call similar to the following:

var links = document["a"];
var closest = links.Closest["td"];

In my case, almost all of the elements selected in links should have a td ancestor, but I am only getting the first one back.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions