fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wlxml: metadata - additional iterator, filtering
[fnpeditor.git]
/
src
/
smartxml
/
smartxml.js
diff --git
a/src/smartxml/smartxml.js
b/src/smartxml/smartxml.js
index
000f722
..
d168e6d
100644
(file)
--- a/
src/smartxml/smartxml.js
+++ b/
src/smartxml/smartxml.js
@@
-33,14
+33,17
@@
$.extend(DocumentNode.prototype, {
},
clone: function() {
},
clone: function() {
- var clone = this._$.clone(true, true);
+ var clone = this._$.clone(true, true),
+ node = this;
clone.find('*').addBack().each(function() {
clone.find('*').addBack().each(function() {
- var clonedData = $(this).data();
+ var el = this,
+ clonedData = $(this).data();
+
_.pairs(clonedData).forEach(function(pair) {
var key = pair[0],
value = pair[1];
if(_.isFunction(value.clone)) {
_.pairs(clonedData).forEach(function(pair) {
var key = pair[0],
value = pair[1];
if(_.isFunction(value.clone)) {
- clonedData[key] = value.clone();
+ clonedData[key] = value.clone(
node.document.createDocumentNode(el)
);
}
});
});
}
});
});
@@
-260,8
+263,7
@@
var registerMethod = function(methodName, method, target) {
};
};
-var Document = function(xml) {
- this.loadXML(xml);
+var Document = function(xml, extensions) {
this.undoStack = [];
this.redoStack = [];
this._transactionStack = [];
this.undoStack = [];
this.redoStack = [];
this._transactionStack = [];
@@
-275,6
+277,11
@@
var Document = function(xml) {
this._elementNodeTransformations = {};
this.registerExtension(coreTransformations);
this._elementNodeTransformations = {};
this.registerExtension(coreTransformations);
+
+ (extensions || []).forEach(function(extension) {
+ this.registerExtension(extension);
+ }.bind(this));
+ this.loadXML(xml);
};
$.extend(Document.prototype, Backbone.Events, {
};
$.extend(Document.prototype, Backbone.Events, {