fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wlxml: linting
[fnpeditor.git]
/
src
/
smartxml
/
smartxml.js
diff --git
a/src/smartxml/smartxml.js
b/src/smartxml/smartxml.js
index
b150cde
..
05583c5
100644
(file)
--- a/
src/smartxml/smartxml.js
+++ b/
src/smartxml/smartxml.js
@@
-91,13
+91,12
@@
$.extend(DocumentNode.prototype, {
}),
wrapWith: function(node) {
}),
wrapWith: function(node) {
- node = node instanceof ElementNode ? node : this.document.createElementNode(node);
-
+ var insertion = this.getNodeInsertion(node);
if(this.parent()) {
if(this.parent()) {
- this.before(
n
ode);
+ this.before(
insertion.ofN
ode);
}
}
-
n
ode.append(this);
- return
n
ode;
+
insertion.ofN
ode.append(this);
+ return
insertion.ofN
ode;
},
/**
},
/**
@@
-136,6
+135,9
@@
$.extend(DocumentNode.prototype, {
},
getIndex: function() {
},
getIndex: function() {
+ if(this.isRoot()) {
+ return 0;
+ }
return this.parent().indexOf(this);
}
});
return this.parent().indexOf(this);
}
});
@@
-255,6
+257,7
@@
$.extend(ElementNode.prototype, {
myContents = this.contents(),
myIdx = parent.indexOf(this);
myContents = this.contents(),
myIdx = parent.indexOf(this);
+
if(myContents.length === 0) {
return this.detach();
}
if(myContents.length === 0) {
return this.detach();
}