diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js
index 095af202f..340a32ee1 100755
--- a/src/definitions/modules/popup.js
+++ b/src/definitions/modules/popup.js
@@ -901,17 +901,49 @@ $.fn.popup.settings = {
popup : '.ui.popup'
},
- template: function(text) {
- var html = '';
- if(typeof text !== undefined) {
- if(typeof text.title !== undefined && text.title) {
- html += '
';
+ escape: function() {
+
+ },
+
+ templates: {
+ escape: function(string) {
+ var
+ badChars = /[&<>"'`]/g,
+ shouldEscape = /[&<>"'`]/,
+ escape = {
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'",
+ "`": "`"
+ },
+ escapedChar = function(chr) {
+ return escape[chr];
+ }
+ ;
+ if(shouldEscape.test(string)) {
+ return string.replace(badChars, escapedChar);
}
- if(typeof text.content !== undefined && text.content) {
- html += '' + text.content + '
';
+ return string;
+ },
+ popup: function(text) {
+ var
+ html = '',
+ escape = $.fn.popup.settings.templates.escape
+ ;
+ if(typeof text !== undefined) {
+ if(typeof text.title !== undefined && text.title) {
+ text.title = escape(text.title);
+ html += '';
+ }
+ if(typeof text.content !== undefined && text.content) {
+ text.content = escape(text.content);
+ html += '' + text.content + '
';
+ }
}
+ return html;
}
- return html;
}
};