ah i see, there's html inside the li

try adding this function:

function text(node) {
    
    if (node.nodeType == 3) {
        return node.textContent;
    }

    if (!node.childNodes.length) {
        return "";
    }

    var childNodeTexts = [];

    for (var i = 0, len = node.childNodes.length; i < len; i++) {
        var childNode = node.childNodes[i];
        childNodeTexts.push(text(childNode));
    }

    return childNodeTexts.join("");
}

then instead of value.innerHTML.trim(), do text(value)