Open andrewkolesnikov opened 11 years ago
The fix should be
function getLastTextNode(element) {
if (element.contents().length) {
var contents = element.contents();
var lastNode = contents.eq(contents.length - 1);
if (lastNode.filter(textNodeFilter).length) {
return lastNode;
} else {
return getLastTextNode(lastNode);
}
} else {
if (element.parent().contents().length) {
element = element.parent()
removeLastEmptyElements(element)
return getLastTextNode(element)
} else {
element.append("");
var contents = element.contents();
return contents.eq(contents.length - 1);
}
}
}
It's trying to append an empty text node inside
<BR>
.See isolated test at http://jsfiddle.net/v8eK7/12/
Inline fix (sry sry):