diff --git a/vendor/assets/javascripts/jquery_ujs.js b/vendor/assets/javascripts/jquery_ujs.js index f63fe049..ea91d755 100644 --- a/vendor/assets/javascripts/jquery_ujs.js +++ b/vendor/assets/javascripts/jquery_ujs.js @@ -12,12 +12,7 @@ // Cut down on the number if issues from people inadvertently including jquery_ujs twice // by detecting and raising an error when it happens. - var alreadyInitialized = function() { - var events = $._data(document, 'events'); - return events && events.click && $.grep(events.click, function(e) { return e.namespace === 'rails'; }).length; - } - - if ( alreadyInitialized() ) { + if ( $.rails !== undefined ) { $.error('jquery-ujs has already been loaded!'); } @@ -258,7 +253,7 @@ // find all the submit events directly bound to the form and // manually invoke them. If anyone returns false then stop the loop callFormSubmitBindings: function(form, event) { - var events = form.data('events'), continuePropagation = true; + var events = jQuery._data(form, 'events'), continuePropagation = true; if (events !== undefined && events['submit'] !== undefined) { $.each(events['submit'], function(i, obj){ if (typeof obj.handler === 'function') return continuePropagation = obj.handler(event); @@ -281,9 +276,7 @@ enableElement: function(element) { if (element.data('ujs:enable-with') !== undefined) { element.html(element.data('ujs:enable-with')); // set to old enabled state - // this should be element.removeData('ujs:enable-with') - // but, there is currently a bug in jquery which makes hyphenated data attributes not get removed - element.data('ujs:enable-with', false); // clean up cache + element.removeData('ujs:enable-with'); // clean up cache } element.unbind('click.railsDisable'); // enable element }