From 8d259f35e7abc75223b7b3c057a893de97388a03 Mon Sep 17 00:00:00 2001 From: Max Chadwick Date: Sat, 28 Mar 2015 17:55:09 -0400 Subject: [PATCH] Use event delegation for option delete buttons on manage attribute screen --- .../templates/catalog/product/attribute/options.phtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index 5f481d0c1bb5c..cb96e8ffa5ea4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -100,7 +100,6 @@ require([ if (isNewOption && !this.isReadOnly) { this.enableNewOptionDeleteButton(data.id); } - this.bindRemoveButton(data.id); this.itemCount++; this.totalItems++; this.updateItemsCountField(); @@ -139,14 +138,16 @@ require([ button.removeClassName('disabled'); }); }, - bindRemoveButton: function(id) { - $('delete_button_' + id).observe('click', this.remove.bind(this)); - } }; if ($('add_new_option_button')) { Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption)); } + + $('manage-options-panel').on('click', '.delete-option', function(event, element) { + attributeOption.remove(event); + }); + getOptionValues() as $_value): ?> attributeOption.add(toJson() ?>);