Update event handling code for compatibility with jQuery 3.0 and above
This commit updates the event handling code to ensure compatibility with jQuery 3.0 and higher versions. The previous code relied on the window.jQuery.event.props property, which has been removed in jQuery 3.0. The updated code checks if the dataTransfer property is defined in the jQuery.event.special object. If not, it adds the property to ensure proper functionality. This modification allows the code to work seamlessly with jQuery 3.0 and above. For more info. please refer [1] and [2]. [1] https://jquery.com/upgrade-guide/3.0/#breaking-change-jquery-event-props-and-jquery-event-fixhooks-removed [2] https://learn.jquery.com/events/event-extensions/ Closes-Bug: 2027728 Change-Id: Ibb6db39b3e78eb6634f06a10417a76d529703de8
This commit is contained in:
parent
aec8e8b122
commit
fbbb6e2cb3
@ -17,7 +17,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
|
||||
|
||||
VERSION = '1.0.2' # version of the packaged files, please use the upstream
|
||||
# version number
|
||||
BUILD = '4' # our package build number, so we can release new builds
|
||||
BUILD = '5' # our package build number, so we can release new builds
|
||||
# with fixes for xstatic stuff.
|
||||
PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi
|
||||
|
||||
|
@ -2,11 +2,21 @@
|
||||
'use strict';
|
||||
|
||||
function isJqueryEventDataTransfer(){
|
||||
return window.jQuery && (-1 == window.jQuery.event.props.indexOf('dataTransfer'));
|
||||
return window.jQuery && (!window.jQuery.event.special.dataTransfer ||
|
||||
!window.jQuery.event.special.dataTransfer.props || -1 ===
|
||||
window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer'));/
|
||||
}
|
||||
|
||||
if (isJqueryEventDataTransfer()) {
|
||||
window.jQuery.event.props.push('dataTransfer');
|
||||
if (!window.jQuery.event.special.dataTransfer) {
|
||||
window.jQuery.event.special.dataTransfer = {
|
||||
props: ['dataTransfer']
|
||||
};
|
||||
} else if (!window.jQuery.event.special.dataTransfer.props) {
|
||||
window.jQuery.event.special.dataTransfer.props = ['dataTransfer'];
|
||||
} else if (-1 === window.jQuery.event.special.dataTransfer.props.indexOf('dataTransfer')) {
|
||||
window.jQuery.event.special.dataTransfer.props.push('dataTransfer');
|
||||
}
|
||||
}
|
||||
|
||||
var module = ng.module('lrDragNDrop', []);
|
||||
@ -181,4 +191,4 @@
|
||||
}
|
||||
};
|
||||
}]);
|
||||
})(angular);
|
||||
})(angular);
|
||||
|
Loading…
x
Reference in New Issue
Block a user