mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-02 10:28:50 +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
20
vendors/knockout/src/binding/defaultBindings/value.js
vendored
Executable file → Normal file
20
vendors/knockout/src/binding/defaultBindings/value.js
vendored
Executable file → Normal file
|
|
@ -11,7 +11,6 @@ ko.bindingHandlers['value'] = {
|
|||
|
||||
var eventsToCatch = [];
|
||||
var requestedEventsToCatch = allBindings.get("valueUpdate");
|
||||
var propertyChangedFired = false;
|
||||
var elementValueBeforeEvent = null;
|
||||
|
||||
if (requestedEventsToCatch) {
|
||||
|
|
@ -19,33 +18,20 @@ ko.bindingHandlers['value'] = {
|
|||
if (typeof requestedEventsToCatch == "string") {
|
||||
eventsToCatch = [requestedEventsToCatch];
|
||||
} else {
|
||||
eventsToCatch = ko.utils.arrayGetDistinctValues(requestedEventsToCatch);
|
||||
eventsToCatch = requestedEventsToCatch ? requestedEventsToCatch.filter(function(item, index) {
|
||||
return requestedEventsToCatch.indexOf(item) === index;
|
||||
}) : [];
|
||||
}
|
||||
ko.utils.arrayRemoveItem(eventsToCatch, "change"); // We'll subscribe to "change" events later
|
||||
}
|
||||
|
||||
var valueUpdateHandler = function() {
|
||||
elementValueBeforeEvent = null;
|
||||
propertyChangedFired = false;
|
||||
var modelValue = valueAccessor();
|
||||
var elementValue = ko.selectExtensions.readValue(element);
|
||||
ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'value', elementValue);
|
||||
}
|
||||
|
||||
// Workaround for https://github.com/SteveSanderson/knockout/issues/122
|
||||
// IE doesn't fire "change" events on textboxes if the user selects a value from its autocomplete list
|
||||
var ieAutoCompleteHackNeeded = ko.utils.ieVersion && isInputElement && element.type == "text"
|
||||
&& element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
|
||||
if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
|
||||
ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
|
||||
ko.utils.registerEventHandler(element, "focus", function () { propertyChangedFired = false });
|
||||
ko.utils.registerEventHandler(element, "blur", function() {
|
||||
if (propertyChangedFired) {
|
||||
valueUpdateHandler();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ko.utils.arrayForEach(eventsToCatch, function(eventName) {
|
||||
// The syntax "after<eventname>" means "run the handler asynchronously after the event"
|
||||
// This is useful, for example, to catch "keydown" events after the browser has updated the control
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue