(function() {
const SKIP_PARENTS = new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA"]);
const walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
{
acceptNode(node) {
const p = node.parentNode;
if (!p || SKIP_PARENTS.has(p.nodeName)) return NodeFilter.FILTER_REJECT;
if (p.nodeName === "INPUT") return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_ACCEPT;
}
}
);
let node;
while ((node = walker.nextNode())) {
node.nodeValue = node.nodeValue.replace(/ſ/g, "s");
}
})()
what?
That will replace the long-s with the standard s. You can do the same for the thorn.
The person you're talking to was wondering if there's a more elegant long-s font choice, not how to replace long-s with short-s.