lib/assets/javascripts/react_ujs.js in react-rails-2.4.3 vs lib/assets/javascripts/react_ujs.js in react-rails-2.4.4.pre
- old
+ new
@@ -126,19 +126,12 @@
turbolinksClassicDeprecatedEvents.teardown(ujs);
pjaxEvents.teardown(ujs);
nativeEvents.teardown(ujs);
}
- if (ujs.jQuery) {
+ if ('addEventListener' in window) {
ujs.handleEvent = function(eventName, callback) {
- ujs.jQuery(document).on(eventName, callback);
- };
- ujs.removeEvent = function(eventName, callback) {
- ujs.jQuery(document).off(eventName, callback);
- }
- } else if ('addEventListener' in window) {
- ujs.handleEvent = function(eventName, callback) {
document.addEventListener(eventName, callback);
};
ujs.removeEvent = function(eventName, callback) {
document.removeEventListener(eventName, callback);
};
@@ -385,23 +378,19 @@
module.exports = {
// Attach handlers to browser events to mount
// (There are no unmount handlers since the page is destroyed on navigation)
setup: function(ujs) {
- if (ujs.jQuery) {
- // Use jQuery if it's present:
- ujs.handleEvent("ready", ujs.handleMount);
- } else if ('addEventListener' in window) {
+ if ('addEventListener' in window) {
ujs.handleEvent('DOMContentLoaded', ujs.handleMount);
} else {
// add support to IE8 without jQuery
ujs.handleEvent('onload', ujs.handleMount);
}
},
teardown: function(ujs) {
- ujs.removeEvent("ready", ujs.handleMount);
ujs.removeEvent('DOMContentLoaded', ujs.handleMount);
ujs.removeEvent('onload', ujs.handleMount);
}
}
@@ -431,17 +420,15 @@
/***/ (function(module, exports) {
module.exports = {
// Turbolinks 5+ got rid of named events (?!)
setup: function(ujs) {
- ujs.handleEvent('DOMContentLoaded', ujs.handleMount)
- ujs.handleEvent('turbolinks:render', ujs.handleMount)
+ ujs.handleEvent('turbolinks:load', ujs.handleMount)
ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount)
},
teardown: function(ujs) {
- ujs.removeEvent('DOMContentLoaded', ujs.handleMount)
- ujs.removeEvent('turbolinks:render', ujs.handleMount)
+ ujs.removeEvent('turbolinks:load', ujs.handleMount)
ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount)
},
}
\ No newline at end of file