Last modified: 2014-07-30 21:04:05 UTC
It works fine if the refs looks like this "[1][2][3]" But it doesn't if they look like this "[1] [2] [3]"
One way to fix this is by replacing nextSibling/previousSibling with nextElementSibling/previousElementSibling. The drawback is that it also finds some elements a bit farther away.
Got a sample page to test with? Probably easyish to fix per Bernd's note
I created one on test wiki, but not sure if they really happen in a real world wiki. https://test.wikipedia.org/wiki/Reference_Test, refs [4]-[7]
Done on the iOS refs branch in: https://gerrit.wikimedia.org/r/#/c/148247/ -- see the goLeft/goRight functions