diff --git a/plugins/gator-legacy.js b/plugins/gator-legacy.js index a96bd12..09fb79e 100644 --- a/plugins/gator-legacy.js +++ b/plugins/gator-legacy.js @@ -27,9 +27,28 @@ type = 'focusout'; } + if (type == 'change') { + gator.element.attachEvent('onfocusin', function(){ + _legacyAttach(type, window.event.srcElement, callback) + }); + } + + if (type == 'submit') { + gator.element.attachEvent('onfocusin', function(){ + _legacyAttach(type, window.event.srcElement.form, callback) + }); + } + gator.element.attachEvent('on' + type, callback); }; + function _legacyAttach(type, element, callback) { + if(element && !element.getAttribute('data-gator-attached')) { + element.attachEvent('on' + type, callback); + element.setAttribute('data-gator-attached','true'); + } + } + Gator.matchesSelector = function(selector) { // check for class name