Wed Jun 14 2017
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
function resetTextNode(el, textswap){
    if(!(el instanceof HTMLElement)){
        throw new TypeError('el must be instanceof HTMLElement');
    }
    if(!textswap){
        return 0; 
    }
    ( Array.prototype.slice.call(( el.childNodes || [])).filter(function(v){ return v.nodeName == '#text' }).pop() || {} ).nodeValue = textswap;
}