fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove empty list
[fnpeditor.git]
/
src
/
smartxml
/
fragments.js
diff --git
a/src/smartxml/fragments.js
b/src/smartxml/fragments.js
index
62a7a4c
..
d932592
100644
(file)
--- a/
src/smartxml/fragments.js
+++ b/
src/smartxml/fragments.js
@@
-19,7
+19,7
@@
$.extend(Fragment.prototype, {
var NodeFragment = function(document, params) {
Fragment.call(this, document);
this.node = params.node;
var NodeFragment = function(document, params) {
Fragment.call(this, document);
this.node = params.node;
- this.nodePath =
params.node.getPath()
;
+ this.nodePath =
this.isValid() ? params.node.getPath() : null
;
};
NodeFragment.prototype = Object.create(Fragment.prototype);
$.extend(NodeFragment.prototype, {
};
NodeFragment.prototype = Object.create(Fragment.prototype);
$.extend(NodeFragment.prototype, {
@@
-27,14
+27,16
@@
$.extend(NodeFragment.prototype, {
return this.document.containsNode(this.node);
},
restoreFromPaths: function() {
return this.document.containsNode(this.node);
},
restoreFromPaths: function() {
- this.node = this.document.getNodeByPath(this.nodePath);
+ if(this.nodePath) {
+ this.node = this.document.getNodeByPath(this.nodePath);
+ }
}
});
var CaretFragment = function(document, params) {
}
});
var CaretFragment = function(document, params) {
- NodeFragment.call(this, document, params);
this.offset = params.offset;
this.offset = params.offset;
+ NodeFragment.call(this, document, params);
};
CaretFragment.prototype = Object.create(NodeFragment.prototype);
};
CaretFragment.prototype = Object.create(NodeFragment.prototype);
@@
-77,6
+79,9
@@
$.extend(RangeFragment.prototype, {
hasSiblingBoundries: function() {
return this.isValid() && this.startNode.isSiblingOf(this.endNode);
},
hasSiblingBoundries: function() {
return this.isValid() && this.startNode.isSiblingOf(this.endNode);
},
+ hasSameBoundries: function() {
+ return this.isValid() && this.startNode.sameNode(this.endNode);
+ },
boundriesSiblingParents: function() {
return this.startNode.document.getSiblingParents({
node1: this.startNode,
boundriesSiblingParents: function() {
return this.startNode.document.getSiblingParents({
node1: this.startNode,