And then I thought for a second, and poked at it.
Then poked at it a little more.
Then tweaked it sideways.
Then tightened it up.
And now... instead of a one-off fix for a single, stupid-ass bug, I've just created what is apparently a global solution for about 5 other "unfixable" bugs and a streamlined replacement for 3 other pieces of code.
Holy SHIT I GET ALL THE WINE I WANT TONIGHT. I AM THAT GOOD.
When I finished cross-platform testing, I stood up and did this at J. (because I'm a weird-ass geek who loves both Clerks and Silence of the Lambs):