app/assets/javascripts/encode_html.js in sprockets-dotjs-2.0.0 vs app/assets/javascripts/encode_html.js in sprockets-dotjs-2.0.2
- old
+ new
@@ -1,7 +1,7 @@
-window.encodeHTML=(function encodeHTMLSource() {
+String.prototype.encodeHTML=function encodeHTMLSource() {
var encodeHTMLRules = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' },
matchHTML = /&(?!#?\w+;)|<|>|"|'|\//g;
- return function(code) {
- return code ? code.toString().replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : '';
+ return function() {
+ return this ? this.replace(matchHTML, function(m) {return encodeHTMLRules[m] || m;}) : this;
};
-}());
+}
\ No newline at end of file