Sha256: dae7279ef3fd513387fbc38ee323c90dd7ab1d8fb33abbceab2ddbe8d3905482
Contents?: true
Size: 770 Bytes
Versions: 179
Compression:
Stored size: 770 Bytes
Contents
<script> promethee.filter('textContentFromHTML', function() { return function(val) { if (val === undefined) return '' // Inner text has a problem with some whitespace/linebreak missing (at least h1, h2...) // We fix it by adding whitespaces before each closing tag. var valWithSpaces = val.split('</').join(' </'); // Create a blank div (supposed to be garbage collected afterwards) var element = document.createElement('div'); // Add value as html element.innerHTML = valWithSpaces; // Use textContent or innerText to convert to plain text // http://perfectionkills.com/the-poor-misunderstood-innerText/ var text = element.textContent || element.innerText return text; } }); </script>
Version data entries
179 entries across 179 versions & 1 rubygems