From 223bd3b0fdcbc35d045df2206c818596e83e1925 Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Tue, 11 Aug 2015 16:37:53 -0400 Subject: [PATCH] Fix hybrid ` initialization **[Merged PR](https://github.com/Semantic-Org/Semantic-UI/issues?q=is%3Aissue+milestone%3A2.1.0+is%3Aclosed)** diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index ebcd718e4..4d255b045 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -211,6 +211,12 @@ $.fn.dropdown = function(parameters) { }); } }, + menu: function() { + $menu = $('
') + .addClass(className.menu) + .appendTo($module) + ; + } }, search: function(query) { @@ -268,6 +274,9 @@ $.fn.dropdown = function(parameters) { module.setup.select(); module.setup.returnedObject(); } + if( !module.has.menu() ) { + module.create.menu(); + } if( module.is.search() && !module.has.search() ) { module.verbose('Adding search input'); $search = $('') @@ -278,12 +287,6 @@ $.fn.dropdown = function(parameters) { if(settings.allowTab) { module.set.tabbable(); } - if($menu.length === 0) { - $menu = $('
') - .addClass(className.menu) - .appendTo($module) - ; - } }, select: function() { var @@ -297,7 +300,10 @@ $.fn.dropdown = function(parameters) { if($input.parent(selector.dropdown).length > 0) { module.debug('UI dropdown already exists. Creating dropdown menu only'); $module = $input.closest(selector.dropdown); - $menu = $module.children(selector.menu); + if( !module.has.menu() ) { + module.create.menu(); + } + $menu = $module.children(selector.menu); module.setup.menu(selectValues); } else {