Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactored jQuery code

Now jQuery does not wait until document:ready to apply event handlers.
This is possible because we use live events and it requires only
document object to be loaded.
  • Loading branch information...
commit f6744578d25a73c23608668fde2a20f7ae9d7d77 1 parent f591c0d
@fxposter fxposter authored lest committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 vendor/assets/javascripts/jquery_nested_form.js
View
4 vendor/assets/javascripts/jquery_nested_form.js
@@ -1,4 +1,4 @@
-jQuery(function($) {
+(function($) {
window.NestedFormEvents = function() {
this.addFields = $.proxy(this.addFields, this);
this.removeFields = $.proxy(this.removeFields, this);
@@ -76,7 +76,7 @@ jQuery(function($) {
$(document)
.delegate('form a.add_nested_fields', 'click', nestedFormEvents.addFields)
.delegate('form a.remove_nested_fields', 'click', nestedFormEvents.removeFields);
-});
+})(jQuery);
// http://plugins.jquery.com/project/closestChild
/*
Please sign in to comment.
Something went wrong with that request. Please try again.