1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-03-23 17:59:14 +03:00

Return 0 if no html

This commit is contained in:
Lim Chee Aun 2022-12-19 17:30:10 +08:00
parent db25770a31
commit 509c1d971e

View file

@ -1,5 +1,6 @@
const div = document.createElement('div');
export default function htmlContentLength(html) {
if (!html) return 0;
div.innerHTML = html;
return div.innerText.length;
}