mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-24 12:13:59 +01:00
Remove focusin/focusout polyfill. Fixes #542 - Inclusion of jquery.validate interfers with focusin and focusout events in IE9
Removed polyfill for focusin and focusout events as this implementation is problematic in IE9, and jQuery core has handled them since 1.4 (1.8.2 is the latest at this point in time). Note that this raises the minimum compatibility of the validation plugin to jQuery 1.4.
This commit is contained in:
31
jquery.validate.js
vendored
31
jquery.validate.js
vendored
@@ -1207,40 +1207,9 @@ $.format = $.validator.format;
|
||||
}
|
||||
}(jQuery));
|
||||
|
||||
// provides cross-browser focusin and focusout events
|
||||
// IE has native support, in other browsers, use event caputuring (neither bubbles)
|
||||
|
||||
// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
|
||||
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
|
||||
(function($) {
|
||||
// only implement if not provided by jQuery core (since 1.4)
|
||||
// TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
|
||||
if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
|
||||
$.each({
|
||||
focus: 'focusin',
|
||||
blur: 'focusout'
|
||||
}, function( original, fix ){
|
||||
$.event.special[fix] = {
|
||||
setup:function() {
|
||||
this.addEventListener( original, handler, true );
|
||||
},
|
||||
teardown:function() {
|
||||
this.removeEventListener( original, handler, true );
|
||||
},
|
||||
handler: function(e) {
|
||||
var args = arguments;
|
||||
args[0] = $.event.fix(e);
|
||||
args[0].type = fix;
|
||||
return $.event.handle.apply(this, args);
|
||||
}
|
||||
};
|
||||
function handler(e) {
|
||||
e = $.event.fix(e);
|
||||
e.type = fix;
|
||||
return $.event.handle.call(this, e);
|
||||
}
|
||||
});
|
||||
}
|
||||
$.extend($.fn, {
|
||||
validateDelegate: function(delegate, type, handler) {
|
||||
return this.bind(type, function(event) {
|
||||
|
||||
Reference in New Issue
Block a user