[go: nahoru, domu]

Skip to content

Commit

Permalink
Revert "Corrected mapping nesting logic"
Browse files Browse the repository at this point in the history
This reverts commit af662c6.
  • Loading branch information
sagacity committed Jan 17, 2013
1 parent af662c6 commit 8f9e83e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions knockout.mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
exports.fromJS = function (jsObject /*, inputOptions, target*/ ) {
if (arguments.length == 0) throw new Error("When calling ko.fromJS, pass the object you want to convert.");

// When mapping is completed, even with an exception, reset the nesting level
try {
if (!mappingNesting++) {
dependentObservables = [];
Expand Down Expand Up @@ -110,11 +111,6 @@
result = target;
}

// Save any new mapping options in the view model, so that updateFromJS can use them later.
result[mappingProperty] = merge(result[mappingProperty], options);

return result;
} finally {
// Evaluate any dependent observables that were proxied.
// Do this after the model's observables have been created
if (!--mappingNesting) {
Expand All @@ -123,6 +119,13 @@
if (DO) DO();
}
}

// Save any new mapping options in the view model, so that updateFromJS can use them later.
result[mappingProperty] = merge(result[mappingProperty], options);

return result;
} finally {
mappingNesting = 0;
}
};

Expand Down

0 comments on commit 8f9e83e

Please sign in to comment.