fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
empty text nodes after spans
[fnpeditor.git]
/
src
/
wlxml
/
wlxml.js
diff --git
a/src/wlxml/wlxml.js
b/src/wlxml/wlxml.js
index
d05eb64
..
ce0ac0a
100644
(file)
--- a/
src/wlxml/wlxml.js
+++ b/
src/wlxml/wlxml.js
@@
-239,7
+239,9
@@
$.extend(WLXMLDocument.prototype, {
});
nativeNode.normalize();
$(nativeNode).find('*').each(function() {
});
nativeNode.normalize();
$(nativeNode).find('*').each(function() {
- if (this.childNodes.length === 0) {
+ var emptyNode = this.childNodes.length === 0;
+ var endsWithSpan = !emptyNode && this.childNodes[this.childNodes.length - 1].nodeName.toLowerCase() === 'span';
+ if(emptyNode || endsWithSpan) {
var fakeTextNode = window.document.createTextNode("");
this.appendChild(fakeTextNode);
}
var fakeTextNode = window.document.createTextNode("");
this.appendChild(fakeTextNode);
}
@@
-295,7
+297,7
@@
$.extend(WLXMLDocument.prototype, {
}
}
}
}
- if(!text.transformed
&& !onlyChild
) {
+ if(!text.transformed
&& !(el.is(':only-child') || (el.is(':last-child') && hasSpanBefore))
) {
addInfo(text.original, 'below');
el.remove();
return true; // continue
addInfo(text.original, 'below');
el.remove();
return true; // continue