https://developer.mozilla.org/en/docs/Web/API/Node/textContent textContent is better when we don't consider about IE8. And, /\r\n|\r|\n/g is more good when counting lines.