You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that indexInMatch is just returning the negative of indexInNode. Is that the expected behavior? I'm having trouble understanding how to use this to locate the portion within the match.
Yep, this is a bug. At the moment indexInMatch only produces a useful number when a match has more than one portion. (When there is only one portion in a match it seems to produce a pointless number)
E.g. of multiple portions:
<div><span>In t<em>h</em>e morning and in the afternoon.</span></div>
The first "the" is split up between three different nodes, and the replace callback is called for each portion, producing an indexInMatch of 0 (t), 1 (h) and 2 (e).
The indexInMatch should definitely be zero for cases of matches with a single portion. I'll have a look into this. Thanks for spotting it!
Hi,
I've noticed that indexInMatch is just returning the negative of indexInNode. Is that the expected behavior? I'm having trouble understanding how to use this to locate the portion within the match.
https://jsfiddle.net/wou9Lxa4/4/
The text was updated successfully, but these errors were encountered: