Skip to content
This repository was archived by the owner on Mar 14, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions src/js/adm.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,9 +1018,8 @@ ADM.copySubtree = function (node) {
for (prop in props) {
if (node.isPropertyExplicit(prop) &&
!BWidget.getPropertyAutoGenerate(type, prop)) {
// do a deep copy of the property to avoid any cross-referencing
newNode.setProperty(prop, $.extend(true, {}, props[prop]),
undefined, true);
// setProperty will do deep copy of the propety value
newNode.setProperty(prop, props[prop], undefined, true);
}
}

Expand Down Expand Up @@ -1949,7 +1948,8 @@ ADMNode.prototype.isPropertyExplicit = function (property) {
* relevant info for performing an undo of this operation.
*/
ADMNode.prototype.setProperty = function (property, value, data, raw) {
var orig, func, changed, type, rval = { };
var orig, func, changed, type, rval = { },
temp = {}, eventData;
type = BWidget.getPropertyType(this.getType(), property);
if (!type) {
console.error("Error: attempted to set non-existent property: " +
Expand Down Expand Up @@ -1992,11 +1992,15 @@ ADMNode.prototype.setProperty = function (property, value, data, raw) {
rval.transactionData = func(this, value, data);
}
orig = this._properties[property];
temp[property] = value;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename "temp" to something more meaningful such as extendingProperties.

$.extend(true, this._properties, temp);
eventData = { type: "propertyChanged",
node: this,
property: property,
oldValue: orig};
$.extend(true, eventData, {newValue: value});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change this? It seems there's no difference between your implementation and the old one.

this._properties[property] = value;
this.fireModelEvent("modelUpdated",
{ type: "propertyChanged", node: this,
property: property, oldValue: orig,
newValue: value });
this.fireModelEvent("modelUpdated", eventData);
rval.result = true;
}
return rval;
Expand Down