From 1f90defbfa7316d4833adece48f2af48b7f5ef5e Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Sat, 1 Feb 2014 19:11:59 +0200 Subject: [PATCH] Fix text rendering for Opera/IE --- src/nodeparser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nodeparser.js b/src/nodeparser.js index a363bd4..c8f2593 100644 --- a/src/nodeparser.js +++ b/src/nodeparser.js @@ -86,8 +86,8 @@ NodeParser.prototype.getBounds = function(node) { NodeParser.prototype.parseTextBounds = function(container) { return function(text, index, textList) { if (container.parent.css("textDecoration") !== "none" || text.trim().length !== 0) { - var offset = textList.slice(0, index).join("").length; if (this.support.rangeBounds) { + var offset = textList.slice(0, index).join("").length; return this.getRangeBounds(container.node, offset, text.length); } else if (container.node && typeof(container.node.data) === "string") { var replacementNode = container.node.splitText(text.length); @@ -95,7 +95,10 @@ NodeParser.prototype.parseTextBounds = function(container) { container.node = replacementNode; return bounds; } + } else if (!this.support.rangeBounds) { + container.node = container.node.splitText(text.length); } + return {}; }; };