Can I limit term selection to one plus parent?

I found an answer that works well. Using two dropdowns in a ‘cascading’ style, with the code in the gist below, users would pick from a list of parent terms first, then a second dropdown appears with the list of children.
The key is that both the parent and the child terms are ‘selected’.

Just took a bit of tweaking to get it right, but it seems to work great.

Thanks to some older code that still works from @hameedullah-khan

https://gist.github.com/hameedullah/997350