snikch/jquery.dirtyforms — pull request #27 by NightOwl888 (2012-04-24 21:16:13+00:00)
Title: Fix for Issues #24 and #25, Added Support for cleanDirty in helpers

I fixed the selector (#24) so the right controls would receive the onFocus event, both present and future. I know, it looks ugly and only 'text' and 'password' fields are technically required for HTML 4, but setting it up this way makes it more future proof because all HTML 5 inputs (except search) and any new inputs that are added to the HTML specification in the future will also be included.

Issue #25 turned out to be caused by the fact that some browsers do not fire the onFocus event when a checkbox or radio button is clicked. There was a pretty simple fix, though - switch those inputs (and select inputs) to use the onchange event. Those inputs and selects fire this event immediately so the workaround (using onfocus) that was done for text inputs doesn't need to be done for these. And since we know the control changed, there is nothing to compare it with to mark it dirty.

Finally, I noticed that the cleanDirty method wasn't working for the tinyMCE control, so I added support for "cleanDirty" and "cleanDirtyNode" methods that can be used to reset the dirty status.