harvesthq/chosen — pull request #900 by CaptainN (2012-11-14 23:43:13+00:00)
Title: Fixes position of invalid error flag on required selects - fixes #515

This fixes the position of the error flag you get when you have an invalid required html5 select field (the value = ""). It does this by showing the actual select field (display:"") but hiding it beneath the chosen field. That way the flag can position itself correctly next to the chosen field, and isn't suppressed by inheriting display:none, etc.

This is a fairly non-intrusive patch, as it only modifies the styles of the select box when the "invalid" DOM event is fired. It could be made less intrusive even by reworking how the "change" handler is added, and name-spacing the invalid and change events in jQuery (not sure if that's supported in prototype).

(This patch has a different build style from mainline - I used the build scripts and followed the instruction in the readme, so I"m not sure why it's different. I'm a node.js and coffeescript noob.)