1function getLinesCount(element) {
2 var prevLH = element.style.lineHeight;
3 var factor = 1000;
4 element.style.lineHeight = factor + 'px';
5
6 var height = element.getBoundingClientRect().height;
7 element.style.lineHeight = prevLH;
8
9 return Math.floor(height / factor);
10}
11