|
416 | 416 | }); |
417 | 417 | }); |
418 | 418 |
|
419 | | - $document.delegate(rails.linkDisableSelector, 'ajax:complete', function() { |
| 419 | + $document.on('ajax:complete', rails.linkDisableSelector, function() { |
420 | 420 | rails.enableElement($(this)); |
421 | 421 | }); |
422 | 422 |
|
423 | | - $document.delegate(rails.buttonDisableSelector, 'ajax:complete', function() { |
| 423 | + $document.on('ajax:complete', rails.buttonDisableSelector, function() { |
424 | 424 | rails.enableFormElement($(this)); |
425 | 425 | }); |
426 | 426 |
|
427 | | - $document.delegate(rails.linkClickSelector, 'click.rails', function(e) { |
| 427 | + $document.on('click.rails', rails.linkClickSelector, function(e) { |
428 | 428 | var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; |
429 | 429 | if (!rails.allowAction(link)) return rails.stopEverything(e); |
430 | 430 |
|
|
448 | 448 | } |
449 | 449 | }); |
450 | 450 |
|
451 | | - $document.delegate(rails.buttonClickSelector, 'click.rails', function(e) { |
| 451 | + $document.on('click.rails', rails.buttonClickSelector, function(e) { |
452 | 452 | var button = $(this); |
453 | 453 |
|
454 | 454 | if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); |
|
465 | 465 | return false; |
466 | 466 | }); |
467 | 467 |
|
468 | | - $document.delegate(rails.inputChangeSelector, 'change.rails', function(e) { |
| 468 | + $document.on('change.rails', rails.inputChangeSelector, function(e) { |
469 | 469 | var link = $(this); |
470 | 470 | if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); |
471 | 471 |
|
472 | 472 | rails.handleRemote(link); |
473 | 473 | return false; |
474 | 474 | }); |
475 | 475 |
|
476 | | - $document.delegate(rails.formSubmitSelector, 'submit.rails', function(e) { |
| 476 | + $document.on('submit.rails', rails.formSubmitSelector, function(e) { |
477 | 477 | var form = $(this), |
478 | 478 | remote = rails.isRemote(form), |
479 | 479 | blankRequiredInputs, |
|
518 | 518 | } |
519 | 519 | }); |
520 | 520 |
|
521 | | - $document.delegate(rails.formInputClickSelector, 'click.rails', function(event) { |
| 521 | + $document.on('click.rails', rails.formInputClickSelector, function(event) { |
522 | 522 | var button = $(this); |
523 | 523 |
|
524 | 524 | if (!rails.allowAction(button)) return rails.stopEverything(event); |
|
539 | 539 | form.data('ujs:submit-button-formmethod', button.attr('formmethod')); |
540 | 540 | }); |
541 | 541 |
|
542 | | - $document.delegate(rails.formSubmitSelector, 'ajax:send.rails', function(event) { |
| 542 | + $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { |
543 | 543 | if (this === event.target) rails.disableFormElements($(this)); |
544 | 544 | }); |
545 | 545 |
|
546 | | - $document.delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) { |
| 546 | + $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { |
547 | 547 | if (this === event.target) rails.enableFormElements($(this)); |
548 | 548 | }); |
549 | 549 |
|
|
0 commit comments