}
}.bind(this));
return toret;
+ },
+ getContextRoot: function() {
+ var contextRoot;
+ [this].concat(this.parents()).some(function(n) {
+ if(n.isContextRoot()) {
+ contextRoot = n;
+ return true;
+ }
+ });
+ return contextRoot;
+ },
+ hasSameContextRoot: function(other) {
+ return this.getContextRoot().sameNode(other.getContextRoot());
}
};
};
WLXMLDocumentNode.prototype = Object.create(smartxml.DocumentNode.prototype);
-
var WLXMLTextNode = function() {
smartxml.TextNode.apply(this, arguments);
};
metadataNode.remove();
});
nativeNode.normalize();
+ $(nativeNode).find('*').each(function() {
+ 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);
+ }
+ });
$(nativeNode).find(':not(iframe)').addBack().contents()
.filter(function() {return this.nodeType === Node.TEXT_NODE;})
}
}
- if(!text.transformed) {
+ if(!text.transformed && !(el.is(':only-child') || (el.is(':last-child') && hasSpanBefore))) {
addInfo(text.original, 'below');
el.remove();
return true; // continue