Skip to content

Commit

Permalink
Bump version to 2.2.0 and rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSanderson committed Oct 28, 2012
1 parent 46c1487 commit 2591251
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 73 deletions.
2 changes: 1 addition & 1 deletion build/fragments/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0rc
2.2.0
45 changes: 29 additions & 16 deletions build/output/knockout-latest.debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Knockout JavaScript library v2.2.0rc
// Knockout JavaScript library v2.2.0
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)

Expand Down Expand Up @@ -37,7 +37,7 @@ ko.exportSymbol = function(koPath, object) {
ko.exportProperty = function(owner, publicName, object) {
owner[publicName] = object;
};
ko.version = "2.2.0rc";
ko.version = "2.2.0";

ko.exportSymbol('version', ko.version);
ko.utils = new (function () {
Expand All @@ -58,6 +58,9 @@ ko.utils = new (function () {
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)
// 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 version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');

Expand Down Expand Up @@ -344,17 +347,21 @@ ko.utils = new (function () {
if ((value === null) || (value === undefined))
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)]);
if (element.nodeType === 3) {
element.data = value;
} 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) {
Expand Down Expand Up @@ -2390,8 +2397,8 @@ ko.bindingHandlers['hasfocus'] = {
ko.utils.registerEventHandler(element, "focusout", handleElementFocusOut); // For IE
},
'update': function(element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
if (!element[hasfocusUpdatingProperty]) {
var value = ko.utils.unwrapObservable(valueAccessor());
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
}
Expand Down Expand Up @@ -2630,6 +2637,7 @@ ko.bindingHandlers['value'] = {
// Always catch "change" event; possibly other events too if asked
var eventsToCatch = ["change"];
var requestedEventsToCatch = allBindingsAccessor()["valueUpdate"];
var propertyChangedFired = false;
if (requestedEventsToCatch) {
if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
requestedEventsToCatch = [requestedEventsToCatch];
Expand All @@ -2638,6 +2646,7 @@ ko.bindingHandlers['value'] = {
}

var valueUpdateHandler = function() {
propertyChangedFired = false;
var modelValue = valueAccessor();
var elementValue = ko.selectExtensions.readValue(element);
ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'value', elementValue);
Expand All @@ -2648,11 +2657,9 @@ ko.bindingHandlers['value'] = {
var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
&& element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
var propertyChangedFired = false;
ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
ko.utils.registerEventHandler(element, "blur", function() {
if (propertyChangedFired) {
propertyChangedFired = false;
valueUpdateHandler();
}
});
Expand Down Expand Up @@ -3422,6 +3429,9 @@ ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
// Call beforeMove first before any changes have been made to the DOM
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)
for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {
// Get nodes for newly added items
Expand All @@ -3441,8 +3451,11 @@ ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
}
}

// Next remove nodes for deleted items; or call beforeRemove, which will remove them
ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);
// If there's a beforeRemove callback, call it after reordering.
// 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);

// Finally call afterMove and afterAdd callbacks
Expand Down
Loading

0 comments on commit 2591251

Please sign in to comment.