code: function(text, attr) {
                  return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function(chr) {
                      return baseEntities[chr] || chr;
                  });
              }
docs: Encodes the specified string using raw entities. This means only the required XML base entities will be encoded.
  
  @method encodeRaw
  @param {String} text Text to encode.
  @param {Boolean} attr Optional flag to specify if the text is attribute contents.
  @return {String} Entity encoded text.