I had to read it a couple times to figure a use-case that would trigger it, but (with that) I've added a unit-test in 25ab3efaa3088988b9ea1d778842d4ad6bb135cf (which verifies both the problem and the fix). If you spot any more edge-cases in here, please feel free to update HtmlClickTrackerTest.
Good catch, @artfulrobot !
I had to read it a couple times to figure a use-case that would trigger it, but (with that) I've added a unit-test in 25ab3efaa3088988b9ea1d778842d4ad6bb135cf (which verifies both the problem and the fix). If you spot any more edge-cases in here, please feel free to update HtmlClickTrackerTest.