Skip to content

Commit

Permalink
fix(dropdown): clean-up some of leftover sui clear logic
Browse files Browse the repository at this point in the history
attach 'click' event to clear icon independent of the on option

closes #171 / Semantic-Org/Semantic-UI#6617 / Semantic-Org/Semantic-UI#6594
  • Loading branch information
ColinFrick authored and Sean Hamilton committed Oct 15, 2018
1 parent 8c21a31 commit df7c655
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/definitions/modules/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@ $.fn.dropdown = function(parameters) {
if(settings.on == 'click') {
$module
.on('click' + eventNamespace, selector.icon, module.event.icon.click)
.on('click' + eventNamespace, selector.clearIcon, module.event.clearIcon.click)
.on('click' + eventNamespace, module.event.test.toggle)
;
}
Expand All @@ -642,6 +641,7 @@ $.fn.dropdown = function(parameters) {
.on('mousedown' + eventNamespace, module.event.mousedown)
.on('mouseup' + eventNamespace, module.event.mouseup)
.on('focus' + eventNamespace, module.event.focus)
.on('click' + eventNamespace, selector.clearIcon, module.event.clearIcon.click)
;
if(module.has.menuSearch() ) {
$module
Expand Down Expand Up @@ -2550,15 +2550,6 @@ $.fn.dropdown = function(parameters) {
$module.data(metadata.value, stringValue);
}
}
if(module.is.single() && settings.clearable) {
// treat undefined or '' as empty
if(!escapedValue) {
module.remove.clearable();
}
else {
module.set.clearable();
}
}
if(settings.fireOnInit === false && module.is.initialLoad()) {
module.verbose('No callback on initial load', settings.onChange);
}
Expand Down Expand Up @@ -2655,9 +2646,6 @@ $.fn.dropdown = function(parameters) {
})
;
},
clearable: function() {
$icon.addClass(className.clear);
},
},

add: {
Expand Down Expand Up @@ -3084,9 +3072,6 @@ $.fn.dropdown = function(parameters) {
;
}
},
clearable: function() {
$icon.removeClass(className.clear);
}
},

has: {
Expand Down Expand Up @@ -3937,7 +3922,6 @@ $.fn.dropdown.settings = {
active : 'active',
addition : 'addition',
animating : 'animating',
clear : 'clear',
disabled : 'disabled',
empty : 'empty',
dropdown : 'ui dropdown',
Expand Down Expand Up @@ -3997,7 +3981,7 @@ $.fn.dropdown.settings.templates = {
html = ''
;
$.each(values, function(index, option) {
var
var
itemType = (option[fields.type])
? option[fields.type]
: 'item'
Expand Down

0 comments on commit df7c655

Please sign in to comment.