Use data-fragment-index for getIndices()

A small patch to use the `data-fragment-index` as the returned index when it is available. This also allows `getIndices()` to return the right index when `data-fragment-index` is used with more than one of the same index. If the attribute is not found or the `data-fragment-index` is not a number, the normal method is used to find the index.