mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 18:08:49 +03:00
Drop support for old browsers and some jQuery
This commit is contained in:
parent
091c4ec811
commit
d06fed09d6
38 changed files with 6137 additions and 872 deletions
19
vendors/knockout/src/binding/defaultBindings/checked.js
vendored
Executable file → Normal file
19
vendors/knockout/src/binding/defaultBindings/checked.js
vendored
Executable file → Normal file
|
|
@ -1,5 +1,16 @@
|
|||
(function() {
|
||||
|
||||
function addOrRemoveItem(array, value, included) {
|
||||
var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.peekObservable(array), value);
|
||||
if (existingEntryIndex < 0) {
|
||||
if (included)
|
||||
array.push(value);
|
||||
} else {
|
||||
if (!included)
|
||||
array.splice(existingEntryIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
ko.bindingHandlers['checked'] = {
|
||||
'after': ['value', 'attr'],
|
||||
'init': function (element, valueAccessor, allBindings) {
|
||||
|
|
@ -45,13 +56,13 @@ ko.bindingHandlers['checked'] = {
|
|||
// currently checked, replace the old elem value with the new elem value
|
||||
// in the model array.
|
||||
if (isChecked) {
|
||||
ko.utils.addOrRemoveItem(writableValue, elemValue, true);
|
||||
ko.utils.addOrRemoveItem(writableValue, saveOldValue, false);
|
||||
addOrRemoveItem(writableValue, elemValue, true);
|
||||
addOrRemoveItem(writableValue, saveOldValue, false);
|
||||
}
|
||||
} else {
|
||||
// When we're responding to the user having checked/unchecked a checkbox,
|
||||
// add/remove the element value to the model array.
|
||||
ko.utils.addOrRemoveItem(writableValue, elemValue, isChecked);
|
||||
addOrRemoveItem(writableValue, elemValue, isChecked);
|
||||
}
|
||||
|
||||
if (rawValueIsNonArrayObservable && ko.isWriteableObservable(modelValue)) {
|
||||
|
|
@ -127,4 +138,4 @@ ko.bindingHandlers['checkedValue'] = {
|
|||
}
|
||||
};
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue