mirror of https://github.com/apache/archiva.git
use knockout 2.2.0 final release
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1403551 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5d09d46ec5
commit
ec1470cd94
|
@ -69,7 +69,7 @@ $.ajax({
|
||||||
"choosen": "chosen.jquery-0.9.8",
|
"choosen": "chosen.jquery-0.9.8",
|
||||||
"jquery.validate": "jquery.validate-1.9.0",
|
"jquery.validate": "jquery.validate-1.9.0",
|
||||||
"jquery.json": "jquery.json-2.3.min",
|
"jquery.json": "jquery.json-2.3.min",
|
||||||
"knockout": "knockout-2.2.0rc.debug",
|
"knockout": "knockout-2.2.0.debug",
|
||||||
"knockout.simpleGrid": "knockout.simpleGrid",
|
"knockout.simpleGrid": "knockout.simpleGrid",
|
||||||
"knockout.sortable": "knockout-sortable",
|
"knockout.sortable": "knockout-sortable",
|
||||||
"jquery.iframe.transport": "jquery.iframe-transport-1.4",
|
"jquery.iframe.transport": "jquery.iframe-transport-1.4",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Knockout JavaScript library v2.2.0rc
|
// Knockout JavaScript library v2.2.0
|
||||||
// (c) Steven Sanderson - http://knockoutjs.com/
|
// (c) Steven Sanderson - http://knockoutjs.com/
|
||||||
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ ko.exportSymbol = function(koPath, object) {
|
||||||
ko.exportProperty = function(owner, publicName, object) {
|
ko.exportProperty = function(owner, publicName, object) {
|
||||||
owner[publicName] = object;
|
owner[publicName] = object;
|
||||||
};
|
};
|
||||||
ko.version = "2.2.0rc";
|
ko.version = "2.2.0";
|
||||||
|
|
||||||
ko.exportSymbol('version', ko.version);
|
ko.exportSymbol('version', ko.version);
|
||||||
ko.utils = new (function () {
|
ko.utils = new (function () {
|
||||||
|
@ -58,6 +58,9 @@ ko.utils = new (function () {
|
||||||
var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406
|
var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406
|
||||||
|
|
||||||
// Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
|
// Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
|
||||||
|
// Note that, since IE 10 does not support conditional comments, the following logic only detects IE < 10.
|
||||||
|
// Currently this is by design, since IE 10+ behaves correctly when treated as a standard browser.
|
||||||
|
// If there is a future need to detect specific versions of IE10+, we will amend this.
|
||||||
var ieVersion = (function() {
|
var ieVersion = (function() {
|
||||||
var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');
|
var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');
|
||||||
|
|
||||||
|
@ -344,17 +347,21 @@ ko.utils = new (function () {
|
||||||
if ((value === null) || (value === undefined))
|
if ((value === null) || (value === undefined))
|
||||||
value = "";
|
value = "";
|
||||||
|
|
||||||
// We need there to be exactly one child: a text node.
|
if (element.nodeType === 3) {
|
||||||
// If there are no children, more than one, or if it's not a text node,
|
element.data = value;
|
||||||
// we'll clear everything and create a single text node.
|
|
||||||
var innerTextNode = ko.virtualElements.firstChild(element);
|
|
||||||
if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) {
|
|
||||||
ko.virtualElements.setDomNodeChildren(element, [document.createTextNode(value)]);
|
|
||||||
} else {
|
} else {
|
||||||
innerTextNode.data = value;
|
// We need there to be exactly one child: a text node.
|
||||||
}
|
// If there are no children, more than one, or if it's not a text node,
|
||||||
|
// we'll clear everything and create a single text node.
|
||||||
|
var innerTextNode = ko.virtualElements.firstChild(element);
|
||||||
|
if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) {
|
||||||
|
ko.virtualElements.setDomNodeChildren(element, [document.createTextNode(value)]);
|
||||||
|
} else {
|
||||||
|
innerTextNode.data = value;
|
||||||
|
}
|
||||||
|
|
||||||
ko.utils.forceRefresh(element);
|
ko.utils.forceRefresh(element);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setElementName: function(element, name) {
|
setElementName: function(element, name) {
|
||||||
|
@ -2390,8 +2397,8 @@ ko.bindingHandlers['hasfocus'] = {
|
||||||
ko.utils.registerEventHandler(element, "focusout", handleElementFocusOut); // For IE
|
ko.utils.registerEventHandler(element, "focusout", handleElementFocusOut); // For IE
|
||||||
},
|
},
|
||||||
'update': function(element, valueAccessor) {
|
'update': function(element, valueAccessor) {
|
||||||
|
var value = ko.utils.unwrapObservable(valueAccessor());
|
||||||
if (!element[hasfocusUpdatingProperty]) {
|
if (!element[hasfocusUpdatingProperty]) {
|
||||||
var value = ko.utils.unwrapObservable(valueAccessor());
|
|
||||||
value ? element.focus() : element.blur();
|
value ? element.focus() : element.blur();
|
||||||
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously
|
ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously
|
||||||
}
|
}
|
||||||
|
@ -2630,6 +2637,7 @@ ko.bindingHandlers['value'] = {
|
||||||
// Always catch "change" event; possibly other events too if asked
|
// Always catch "change" event; possibly other events too if asked
|
||||||
var eventsToCatch = ["change"];
|
var eventsToCatch = ["change"];
|
||||||
var requestedEventsToCatch = allBindingsAccessor()["valueUpdate"];
|
var requestedEventsToCatch = allBindingsAccessor()["valueUpdate"];
|
||||||
|
var propertyChangedFired = false;
|
||||||
if (requestedEventsToCatch) {
|
if (requestedEventsToCatch) {
|
||||||
if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
|
if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
|
||||||
requestedEventsToCatch = [requestedEventsToCatch];
|
requestedEventsToCatch = [requestedEventsToCatch];
|
||||||
|
@ -2638,6 +2646,7 @@ ko.bindingHandlers['value'] = {
|
||||||
}
|
}
|
||||||
|
|
||||||
var valueUpdateHandler = function() {
|
var valueUpdateHandler = function() {
|
||||||
|
propertyChangedFired = false;
|
||||||
var modelValue = valueAccessor();
|
var modelValue = valueAccessor();
|
||||||
var elementValue = ko.selectExtensions.readValue(element);
|
var elementValue = ko.selectExtensions.readValue(element);
|
||||||
ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'value', elementValue);
|
ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'value', elementValue);
|
||||||
|
@ -2648,11 +2657,9 @@ ko.bindingHandlers['value'] = {
|
||||||
var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
|
var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
|
||||||
&& element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
|
&& element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
|
||||||
if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
|
if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
|
||||||
var propertyChangedFired = false;
|
|
||||||
ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
|
ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
|
||||||
ko.utils.registerEventHandler(element, "blur", function() {
|
ko.utils.registerEventHandler(element, "blur", function() {
|
||||||
if (propertyChangedFired) {
|
if (propertyChangedFired) {
|
||||||
propertyChangedFired = false;
|
|
||||||
valueUpdateHandler();
|
valueUpdateHandler();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3422,6 +3429,9 @@ ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
|
||||||
// Call beforeMove first before any changes have been made to the DOM
|
// Call beforeMove first before any changes have been made to the DOM
|
||||||
callCallback(options['beforeMove'], itemsForMoveCallbacks);
|
callCallback(options['beforeMove'], itemsForMoveCallbacks);
|
||||||
|
|
||||||
|
// Next remove nodes for deleted items (or just clean if there's a beforeRemove callback)
|
||||||
|
ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);
|
||||||
|
|
||||||
// Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)
|
// Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)
|
||||||
for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {
|
for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {
|
||||||
// Get nodes for newly added items
|
// Get nodes for newly added items
|
||||||
|
@ -3441,8 +3451,11 @@ ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next remove nodes for deleted items; or call beforeRemove, which will remove them
|
// If there's a beforeRemove callback, call it after reordering.
|
||||||
ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);
|
// Note that we assume that the beforeRemove callback will usually be used to remove the nodes using
|
||||||
|
// some sort of animation, which is why we first reorder the nodes that will be removed. If the
|
||||||
|
// callback instead removes the nodes right away, it would be more efficient to skip reordering them.
|
||||||
|
// Perhaps we'll make that change in the future if this scenario becomes more common.
|
||||||
callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks);
|
callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks);
|
||||||
|
|
||||||
// Finally call afterMove and afterAdd callbacks
|
// Finally call afterMove and afterAdd callbacks
|
Loading…
Reference in New Issue