fixed parent issue (only one parent per Y.Xml type)

This commit is contained in:
DadaMonad
2015-02-25 23:41:57 +00:00
parent 9059618d1f
commit 82f11c421f
11 changed files with 114 additions and 52 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -45,7 +45,13 @@ module.exports = function() {
};
Operation.prototype.callEvent = function() {
return this.forwardEvent.apply(this, [this].concat(__slice.call(arguments)));
var callon;
if (this.custom_type != null) {
callon = this.getCustomType();
} else {
callon = this;
}
return this.forwardEvent.apply(this, [callon].concat(__slice.call(arguments)));
};
Operation.prototype.forwardEvent = function() {

View File

@@ -46,13 +46,31 @@ YXml = (function() {
this._model.val("parent", this._xml.parent);
}
}
delete this._xml;
this._setModel(this._model);
return this._model;
};
YXml.prototype._setModel = function(_at__model) {
this._model = _at__model;
return delete this._xml;
delete this._xml;
return this._model.observe(function(events) {
var c, event, i, parent, _i, _j, _len, _len1, _ref;
for (_i = 0, _len = events.length; _i < _len; _i++) {
event = events[_i];
if (event.name === "parent" && event.type !== "add") {
parent = event.oldValue;
_ref = parent.getChildren();
for (i = _j = 0, _len1 = _ref.length; _j < _len1; i = ++_j) {
c = _ref[i];
if (c === this) {
parent._model.val("children")["delete"](i);
break;
}
}
}
}
return void 0;
});
};
YXml.prototype._setParent = function(parent) {
@@ -220,19 +238,9 @@ YXml = (function() {
};
YXml.prototype.remove = function() {
var c, i, parent, _i, _len, _ref;
parent = this._model.val("parent");
if (parent instanceof YXml) {
_ref = parent.getChildren();
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
c = _ref[i];
if (c === this) {
parent._model.val("children")["delete"](i);
break;
}
}
}
return void 0;
var parent;
parent = this._model["delete"]("parent");
return this;
};
YXml.prototype.removeAttr = function(attrName) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long