From ef94ea8e65ddd8639fd5c2aa30fd6ff8ad8d06af Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 6 Aug 2017 12:02:47 -0700 Subject: [PATCH] #4029 Fixes issue with dropdown mutation observer not handling case where entire modified, recreating menu'); - module.setup.select(); + var + isSelectMutation = false + ; + $.each(mutations, function(index, mutation) { + if($(mutation.target).is('select') || $(mutation.addedNodes).is('select')) { + isSelectMutation = true; + return true; + } + }); + if(isSelectMutation) { + module.disconnect.selectObserver(); + module.refresh(); + module.setup.select(); + module.set.selected(); + module.observe.select(); + } } }, menu: { @@ -1616,6 +1654,9 @@ $.fn.dropdown = function(parameters) { return $module.data(metadata.defaultValue); }, placeholderText: function() { + if(settings.placeholder != 'auto' && typeof settings.placeholder == 'string') { + return settings.placeholder; + } return $module.data(metadata.placeholderText) || ''; }, text: function() { @@ -3041,7 +3082,7 @@ $.fn.dropdown = function(parameters) { return $(event.target).closest($icon).length > 0; }, alreadySetup: function() { - return ($module.is('select') && $module.parent(selector.dropdown).length > 0 && $module.prev().length === 0); + return ($module.is('select') && $module.parent(selector.dropdown).data(moduleNamespace) !== undefined && $module.prev().length === 0); }, animating: function($subMenu) { return ($subMenu) @@ -3591,6 +3632,7 @@ $.fn.dropdown.settings = { on : 'click', // what event should show menu action on item selection action : 'activate', // action on item selection (nothing, activate, select, combo, hide, function(){}) + values : false, // specify values to use for dropdown apiSettings : false, selectOnKeydown : true, // Whether selection should occur automatically when keyboard shortcuts used