Title / Description
Code function getTextFromTextNode(range, textNode) { if (range.startContainer.equals(textNode) && range.startOffset > 0) { if (range.endContainer.equals(textNode)) { return textNode.getText().substr(range.startOffset, range.endOffset - range.startOffset); } return textNode.getText().substr(range.startOffset); } if (range.endContainer.equals(textNode)) { return textNode.getText().substr(0, range.endOffset); } return textNode.getText(); }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code