Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replace remaining uses of delegate/live in JavaScript in core with on…

… instead
  • Loading branch information...
commit f67d22f9e519e68f58bc0b96f0f864baa45d9d3c 1 parent c64df3c
@radar radar authored
View
2  core/app/assets/javascripts/admin/admin.js.erb
@@ -226,7 +226,7 @@ $(document).ready(function(){
handle_date_picker_fields();
- $(".select_properties_from_prototype").live("click", function(){
+ $(".select_properties_from_prototype").on("click", function(){
$("#busy_indicator").show();
var clicked_link = $(this);
$.ajax({ dataType: 'script', url: clicked_link.attr("href"), type: 'get',
View
4 core/app/assets/javascripts/admin/image_settings.js
@@ -8,11 +8,11 @@ $(document).ready(function() {
$('#s3_settings').toggle();
});
- $('.destroy_style').live("click", function() {
+ $('.destroy_style').on("click", function() {
$(this).parent().remove();
});
- $('.destroy_header').live("click", function() {
+ $('.destroy_header').on("click", function() {
$(this).parent().remove();
});
View
2  core/app/assets/javascripts/admin/orders/edit.js
@@ -1,6 +1,6 @@
$(document).ready(function(){
- $("#add_line_item_to_order").live("click", function(){
+ $("#add_line_item_to_order").on("click", function(){
if($('#add_variant_id').val() == ''){ return false; }
update_target = $(this).attr("data-update");
$.ajax({ dataType: 'script', url: this.href, type: "POST",
View
2  core/app/assets/javascripts/admin/orders/edit_form.js
@@ -1,7 +1,7 @@
$(document).ready(function() {
$.each($('td.qty input'), function(i, input) {
- $(input).live('change', function() {
+ $(input).on('change', function() {
var id = "#" + $(this).attr('id').replace("_quantity", "_id");
console.log($(this))
View
2  core/app/assets/javascripts/admin/taxonomy.js
@@ -190,7 +190,7 @@ $(document).ready(function(){
.bind("create.jstree", handle_create)
.bind("rename.jstree", handle_rename);
- $("#taxonomy_tree").delegate("a", "dblclick", function (e) {
+ $("#taxonomy_tree a").on("dblclick", function (e) {
$("#taxonomy_tree").jstree("rename", this)
});
View
6 core/app/assets/javascripts/store/product.js
@@ -2,7 +2,7 @@ var add_image_handlers = function() {
$("#main-image").data('selectedThumb', $('#main-image img').attr('src'));
$('ul.thumbnails li').eq(0).addClass('selected');
- $('ul.thumbnails').delegate('a', 'click', function(event) {
+ $('ul.thumbnails a').on('click', function(event) {
$("#main-image").data('selectedThumb', $(event.currentTarget).attr('href'));
$("#main-image").data('selectedThumbId', $(event.currentTarget).parent().attr('id'));
$(this).mouseout(function() {
@@ -11,10 +11,10 @@ var add_image_handlers = function() {
});
return false;
});
- $('ul.thumbnails').delegate('li', 'mouseenter', function(event) {
+ $('ul.thumbnails li').on('mouseenter', function(event) {
$('#main-image img').attr('src', $(event.currentTarget).find('a').attr('href'));
});
- $('ul.thumbnails').delegate('li', 'mouseleave', function(event) {
+ $('ul.thumbnails li').on('mouseleave', function(event) {
$('#main-image img').attr('src', $("#main-image").data('selectedThumb'));
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.