> I'm pretty sure that the latter can be made to function.

Are you suggesting a rework of the existing code is in order, or is this an alternative implementation that doesn't use a the data attribute?