setTag: function(tagName) {
var node = this.document.createElementNode({tagName: tagName}),
- oldTagName = this.getTagName();
+ oldTagName = this.getTagName(),
+ myContents = this._$.contents();
this.getAttrs().forEach(function(attribute) {
node.setAttr(attribute.name, attribute.value, true);
}
this._$.replaceWith(node._$);
this._setNativeNode(node._$[0]);
+ this._$.append(myContents);
this.triggerChangeEvent('nodeTagChange', {oldTagName: oldTagName, newTagName: this.getTagName()});
},
toXML: function() {
var wrapper = $('<div>');
- wrapper.append(this._$);
+ wrapper.append(this._getXMLDOMToDump());
return wrapper.html();
+ },
+
+ _getXMLDOMToDump: function() {
+ return this._$;
}
});