Nodejs HTML Decode decodeHtmlEntity()

Here you can find the source of decodeHtmlEntity()

Method Source Code

String.prototype.decodeHtmlEntity = function(){
    var ta = document.createElement('textarea');
    ta.innerHTML = this;/*ww w .ja v  a  2 s.c  o m*/
    return ta.value;
};

Related

  1. htmlDecode(value)
    function htmlDecode(value)
        if(value)
            return $("<div />").html(value).text();
        else
            return '';
    ...
    
  2. htmlDecode()
    String.prototype.htmlDecode = function() {
      return this.replace(/\&amp\;/g, '\&').replace(/\&gt\;/g, '\>').replace(
          /\&lt\;/g, '\<').replace(/\&quot\;/g, '\'').replace(/\&\#39\;/g,
          '\'');
    };
    
  3. htmlDecode()
    String.prototype.htmlDecode = function () {
        var div = document.createElement('div');
        div.innerHTML = this;
        return div.innerText || div.textContent;
    };
    
  4. decodeHtml()
    String.prototype.decodeHtml = function () {
        var string = new String(this);
        string = string.replace(/&lt;/g, "<");
        string = string.replace(/&gt;/g, ">");
        string = string.replace(/&quot;/g,  "\"")
        string = string.replace(/&39;/g,  "'");
        string = string.replace(/&amp;/g, "&");
        return string