mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-02 02:18:49 +03:00
Remove more unused Knockout code
This commit is contained in:
parent
07857a06a9
commit
ac535b1d03
14 changed files with 155 additions and 355 deletions
|
|
@ -34,16 +34,6 @@ ko.bindingHandlers['hasfocus'] = {
|
|||
|
||||
if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {
|
||||
value ? element.focus() : element.blur();
|
||||
|
||||
// In IE, the blur method doesn't always cause the element to lose focus (for example, if the window is not in focus).
|
||||
// Setting focus to the body element does seem to be reliable in IE, but should only be used if we know that the current
|
||||
// element was focused already.
|
||||
if (!value && element[hasfocusLastValue]) {
|
||||
element.ownerDocument.body.focus();
|
||||
}
|
||||
|
||||
// For IE, which doesn't reliably fire "focus" or "blur" events synchronously
|
||||
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ ko.bindingHandlers['options'] = {
|
|||
},
|
||||
'update': (element, valueAccessor, allBindings) => {
|
||||
function selectedOptions() {
|
||||
return ko.utils.arrayFilter(element.options, node => node.selected);
|
||||
return Array.from(element.options).filter(node => node.selected);
|
||||
}
|
||||
|
||||
var selectWasPreviouslyEmpty = element.length == 0,
|
||||
|
|
@ -22,7 +22,6 @@ ko.bindingHandlers['options'] = {
|
|||
previousScrollTop = (!selectWasPreviouslyEmpty && multiple) ? element.scrollTop : null,
|
||||
unwrappedArray = ko.utils.unwrapObservable(valueAccessor()),
|
||||
valueAllowUnset = allBindings.get('valueAllowUnset') && allBindings['has']('value'),
|
||||
includeDestroyed = allBindings.get('optionsIncludeDestroyed'),
|
||||
arrayToDomNodeChildrenOptions = {},
|
||||
captionValue,
|
||||
filteredArray,
|
||||
|
|
@ -41,9 +40,7 @@ ko.bindingHandlers['options'] = {
|
|||
unwrappedArray = [unwrappedArray];
|
||||
|
||||
// Filter out any entries marked as destroyed
|
||||
filteredArray = ko.utils.arrayFilter(unwrappedArray, item =>
|
||||
includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy'])
|
||||
);
|
||||
filteredArray = unwrappedArray.filter(item => item || item == null);
|
||||
|
||||
// If caption is included, add it to the array
|
||||
if (allBindings['has']('optionsCaption')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue