app/assets/javascripts/bhf/mootools_ujs.js in bhf-0.9.1 vs app/assets/javascripts/bhf/mootools_ujs.js in bhf-0.9.2
- old
+ new
@@ -15,28 +15,28 @@
- Rails 3 MooTools driver
...
*/
-(function($){
- var domReadyCallback = function(){
- rails.csrf = {
- token: rails.getCsrf('token'),
- param: rails.getCsrf('param')
- };
+window.addEvent('domready', function(){
- rails.applyEvents();
+ rails.csrf = {
+ token: rails.getCsrf('token'),
+ param: rails.getCsrf('param')
};
- window.addEvent('domready', domReadyCallback);
- document.addEventListener('page:load', domReadyCallback);
+
+ rails.applyEvents();
+});
+(function($){
+
window.rails = {
/**
* If el is passed as argument, events will only be applied to
* elements within el. Otherwise applied to document body.
*/
applyEvents: function(el){
- el = $(el || document.body);
+ el = $(el || document);
var apply = function(selector, action, callback){
el.addEvent(action + ':relay(' + selector + ')', callback);
};
apply('form[data-remote="true"]', 'submit', rails.handleRemote);
\ No newline at end of file