mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
KnockoutJS drop unused optionsCaption
This commit is contained in:
parent
bb3fc79e09
commit
acf1be454f
1 changed files with 1 additions and 10 deletions
|
|
@ -62,15 +62,6 @@ ko.bindingHandlers['options'] = {
|
||||||
|
|
||||||
// Filter out any entries marked as destroyed
|
// Filter out any entries marked as destroyed
|
||||||
filteredArray = unwrappedArray.filter(item => item || item == null);
|
filteredArray = unwrappedArray.filter(item => item || item == null);
|
||||||
|
|
||||||
// If caption is included, add it to the array
|
|
||||||
if (allBindings['has']('optionsCaption')) {
|
|
||||||
captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption'));
|
|
||||||
// If caption value is null or undefined, don't show a caption
|
|
||||||
if (captionValue != null) {
|
|
||||||
filteredArray.unshift(captionPlaceholder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// If a falsy value is provided (e.g. null), we'll simply empty the select element
|
// If a falsy value is provided (e.g. null), we'll simply empty the select element
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +78,7 @@ ko.bindingHandlers['options'] = {
|
||||||
}
|
}
|
||||||
var option = element.ownerDocument.createElement("option");
|
var option = element.ownerDocument.createElement("option");
|
||||||
if (arrayEntry === captionPlaceholder) {
|
if (arrayEntry === captionPlaceholder) {
|
||||||
ko.utils.setTextContent(option, allBindings.get('optionsCaption'));
|
ko.utils.setTextContent(option);
|
||||||
ko.selectExtensions.writeValue(option, undefined);
|
ko.selectExtensions.writeValue(option, undefined);
|
||||||
} else {
|
} else {
|
||||||
// Apply a value to the option element
|
// Apply a value to the option element
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue