fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
logging: fix in ravenjs handler
[fnpeditor.git]
/
src
/
smartxml
/
smartxml.js
diff --git
a/src/smartxml/smartxml.js
b/src/smartxml/smartxml.js
index
d9e44be
..
acbe04d
100644
(file)
--- a/
src/smartxml/smartxml.js
+++ b/
src/smartxml/smartxml.js
@@
-222,7
+222,12
@@
$.extend(TextNode.prototype, {
var parseXML = function(xml) {
var parseXML = function(xml) {
- return $($.trim(xml))[0];
+ var toret = $($.trim(xml));
+ if(!toret.length) {
+ throw new Error('Unable to parse XML: ' + xml);
+ }
+ return toret[0];
+
};
var registerTransformation = function(desc, name, target) {
};
var registerTransformation = function(desc, name, target) {
@@
-276,6
+281,9
@@
$.extend(Document.prototype, Backbone.Events, {
/* globals document */
from = document.createTextNode(from.text);
} else {
/* globals document */
from = document.createTextNode(from.text);
} else {
+ if(!from.tagName) {
+ throw new Error('tagName missing');
+ }
var node = $('<' + from.tagName + '>');
_.keys(from.attrs || {}).forEach(function(key) {
var node = $('<' + from.tagName + '>');
_.keys(from.attrs || {}).forEach(function(key) {
@@
-509,8
+517,10
@@
$.extend(Document.prototype, Backbone.Events, {
throw new Error('End of transaction requested, but there is no transaction in progress!');
}
this._transactionInProgress = false;
throw new Error('End of transaction requested, but there is no transaction in progress!');
}
this._transactionInProgress = false;
- this.undoStack.push(this._transactionStack);
- this._transactionStack = [];
+ if(this._transactionStack.length) {
+ this.undoStack.push(this._transactionStack);
+ this._transactionStack = [];
+ }
},
getNodeByPath: function(path) {
},
getNodeByPath: function(path) {