Facebook shows the "likes" on a post ("x people like this") through an anchor whose tooltip content is loaded dynamically on hover. For example, this publicly-available Facebook post has a "1,453 people" [like this] anchor defined as:
<a data-testid="n_other_people_link"
class="UFINoWrap"
rel="dialog"
ajaxify="/ajax/browser/dialog/likes?actorid=104958162837&id=10152950941352838"
href="/browse/likes?actorid=104958162837&id=10152950941352838"
data-hover="tooltip"
data-tooltip-alignh="center"
data-tooltip-uri="/ajax/like/tooltip.php?comment_fbid=10152950941352838&comment_from=643726632&seen_user_fbids=true&av=643726632"
role="button"
data-reactid=".2.1:1.0.$right.0.0.0.$range0/=10">
1,453 people
</a>
On hover, this anchor acquires an aria-label
attribute containing the names of the persons who liked the post. The content is retrieved asynchronously from Facebook through AJAX.
<a data-testid="n_other_people_link"
class="UFINoWrap"
rel="dialog"
ajaxify="/ajax/browser/dialog/likes?actorid=104958162837&id=10152950941352838"
href="/browse/likes?actorid=104958162837&id=10152950941352838"
data-hover="tooltip"
data-tooltip-alignh="center"
role="button"
data-reactid=".2.1:1.0.$right.0.0.0.$range0/=10"
aria-label="(Name 1)
(Name 2)
(...)
and 1,434 more..."
id="js_9">
1,453 people
</a>
Is there a way of simulating this behaviour – namely, getting the aria-label
attribute populated – through JavaScript or jQuery? I'm using the Console feature of the browser's developer tools (Firefox or Chrome). I can get the aria-label
populated by invoking the click
event, but that causes a dialog to be launched as well; I just need the "hover" behaviour.