References: Fix js errors in the case of repeated references

Getting the reference data for a reference is very easy
in the cases one reference used only once in the page.

Such a reference link will have data-mw carrying the data.

But when the same reference used in multiple places, this is tricky.
The page will have the following markup(example) at the end of page, saying all these 3
references are same. One of these links will have reference data. Not necessarily
first one. So we have to iterate through all these siblings and find which one has
reference data.

Example from Antipasto article from eswiki:
 <li about="#cite_note-Jöel-1" data-parsoid="{}" id="130">
   <span data-parsoid="{}" rel="mw:referencedBy">↑
     <a class="cx-link" data-linkid="132" data-parsoid="{}" href="#cite_ref-Jöel-1-0">1.0</a>
     <a class="cx-link" data-linkid="133" data-parsoid="{}" href="#cite_ref-Jöel-1-1">1.1</a>
     <a class="cx-link" data-linkid="134" data-parsoid="{}" href="#cite_ref-Jöel-1-2">1.2</a>
   </span>
 </li>

Change-Id: Ifcfc5b9fbc8cd810a0ecf3e1fcf725260450c232
Merge "References: Fix js errors in the case of repeated references"