Changeset 506 for trunk/js


Ignore:
Timestamp:
Apr 5, 2015 12:48:13 AM (9 years ago)
Author:
anonymous
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/js/Utilities.js

    r500 r506  
    7070
    7171/*
    72 * Encode HTML by proxying content via an in-memory div, setting its inner text which jQuery automatically encodes.
     72* Encode/decode HTML by proxying content via an in-memory div, setting its inner text which jQuery automatically encodes.
    7373Then we pull the encoded contents back out. The div never exists on the page.
    7474---------------------------------------------------------------------
    7575$('select').append($('<option>', {
    7676    value: value,
    77     text: htmlEncode(text)
     77    text: Strangecode.htmlEncode(text)
    7878}));
    7979---------------------------------------------------------------------
    8080*
    8181* @access   public
    82 * @version  1.0
     82* @version  1.1
    8383* @since    30 Jun 2013
    8484*/
     
    8686    return $('<div/>').text(text).html();
    8787};
    88 jQuery.fn.htmlEncode = Strangecode.htmlEncode;
     88Strangecode.htmlDecode = function(text) {
     89    return $('<div/>').html(value).text();
     90};
Note: See TracChangeset for help on using the changeset viewer.