diff --git a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js index 59da08b4..892be08a 100644 --- a/source/Ox.UI/js/Calendar/Ox.ListCalendar.js +++ b/source/Ox.UI/js/Calendar/Ox.ListCalendar.js @@ -606,9 +606,9 @@ Ox.ListCalendar = function(options, self) { function decodeValues(place) { return Ox.map(place, function(value) { - return Ox.isString(value) ? Ox.decodeHTML(value) + return Ox.isString(value) ? Ox.decodeHTMLEntities(value) : Ox.isArray(value) ? Ox.map(value, function(value) { - return Ox.decodeHTML(value); + return Ox.decodeHTMLEntities(value); }) : value; }); @@ -632,9 +632,9 @@ Ox.ListCalendar = function(options, self) { function encodeValues(place) { return Ox.map(place, function(value) { - return Ox.isString(value) ? Ox.encodeHTML(value) + return Ox.isString(value) ? Ox.encodeHTMLEntities(value) : Ox.isArray(value) ? Ox.map(value, function(value) { - return Ox.encodeHTML(value); + return Ox.encodeHTMLEntities(value); }) : value; }); diff --git a/source/Ox.UI/js/Code/Ox.DocPage.js b/source/Ox.UI/js/Code/Ox.DocPage.js index 45627ea2..401571d1 100644 --- a/source/Ox.UI/js/Code/Ox.DocPage.js +++ b/source/Ox.UI/js/Code/Ox.DocPage.js @@ -88,7 +88,7 @@ Ox.DocPage = function(options, self) { '' + (name || item.name) + ' ' + '<' + item.types.join('> or <') + '> ' + (item['default'] ? '(default: ' + item['default'] + ') ' : '') - + Ox.parseHTML(item.summary) + + Ox.sanitizeHTML(item.summary) ) ]; [ @@ -105,7 +105,7 @@ Ox.DocPage = function(options, self) { marginTop: (level ? 0 : 8) + 'px', marginLeft: (level * 32) + 'px' }) - .html(Ox.parseHTML(item.description)) + .html(Ox.sanitizeHTML(item.description)) ); } else { $elements.push($('
') @@ -160,7 +160,7 @@ Ox.DocPage = function(options, self) { .css({marginLeft: (level * 32 + 16) + 'px'}) .html( '> ' - + Ox.encodeHTML(example.statement) + + Ox.encodeHTMLEntities(example.statement) .replace(/ /g, ' ') .replace(/\n/g, '
\n  ') + '
' @@ -170,7 +170,7 @@ Ox.DocPage = function(options, self) { .addClass(className) .css({marginLeft: (level * 32 + 16) + 'px'}) .html( - '' + Ox.encodeHTML(example.result) + '' + '' + Ox.encodeHTMLEntities(example.result) + '' ) ) }); diff --git a/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js b/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js index 5a69ce20..569ce797 100644 --- a/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js +++ b/source/Ox.UI/js/Code/Ox.SyntaxHighlighter.js @@ -71,7 +71,7 @@ Ox.SyntaxHighlighter = function(options, self) { } } source += '' + - Ox.encodeHTML(token.value) + Ox.encodeHTMLEntities(token.value) .replace(/ /g, whitespace) .replace(/\t/g, tab) .replace(/\n/g, linebreak) + ''; diff --git a/source/Ox.UI/js/Form/Ox.Editable.js b/source/Ox.UI/js/Form/Ox.Editable.js index da294447..07656d0a 100644 --- a/source/Ox.UI/js/Form/Ox.Editable.js +++ b/source/Ox.UI/js/Form/Ox.Editable.js @@ -155,7 +155,7 @@ Ox.Editable = function(options, self) { } function formatInputValue() { - return Ox.decodeHTML( + return Ox.decodeHTMLEntities( self.options.type == 'input' ? self.options.value : self.options.value.replace(//g, '\n\n') @@ -163,7 +163,7 @@ Ox.Editable = function(options, self) { } function formatTestValue() { - var value = Ox.encodeHTML(self.$input.options('value')); + var value = Ox.encodeHTMLEntities(self.$input.options('value')); return !value ? ' ' : self.options.type == 'input' ? value.replace(/ /g, ' ') @@ -181,7 +181,7 @@ Ox.Editable = function(options, self) { value = self.options.format(self.options.value) } if (self.options.highlight) { - value = Ox.highlightHTML(value, self.options.highlight, 'OxHighlight'); + value = Ox.highlightHTML(value, self.options.highlight, 'OxHighlight', true); } return value; } @@ -191,8 +191,8 @@ Ox.Editable = function(options, self) { self.$input.value().replace(/\n\n+/g, '\0') ).replace(/\0/g, '\n\n').trim(); return (self.options.type == 'input' - ? Ox.encodeHTML(value) - : Ox.parseHTML(value) + ? Ox.encodeHTMLEntities(value) + : Ox.sanitizeHTML(value) ); } diff --git a/source/Ox.UI/js/Map/Ox.ListMap.js b/source/Ox.UI/js/Map/Ox.ListMap.js index 83868761..45a464c4 100644 --- a/source/Ox.UI/js/Map/Ox.ListMap.js +++ b/source/Ox.UI/js/Map/Ox.ListMap.js @@ -834,9 +834,9 @@ Ox.ListMap = function(options, self) { function decodeValues(place) { return Ox.map(place, function(value) { - return Ox.isString(value) ? Ox.decodeHTML(value) + return Ox.isString(value) ? Ox.decodeHTMLEntities(value) : Ox.isArray(value) ? Ox.map(value, function(value) { - return Ox.decodeHTML(value); + return Ox.decodeHTMLEntities(value); }) : value; }); @@ -849,9 +849,9 @@ Ox.ListMap = function(options, self) { function encodeValues(place) { return Ox.map(place, function(value) { - return Ox.isString(value) ? Ox.encodeHTML(value) + return Ox.isString(value) ? Ox.encodeHTMLEntities(value) : Ox.isArray(value) ? Ox.map(value, function(value) { - return Ox.encodeHTML(value); + return Ox.encodeHTMLEntities(value); }) : value; }); diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index acc41e98..5287d485 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -820,7 +820,7 @@ Ox.VideoEditor = function(options, self) { if (query.length) { query = query.toLowerCase(); results = self.annotations.filter(function(annotation) { - return Ox.decodeHTML(Ox.stripTags( + return Ox.decodeHTMLEntities(Ox.stripTags( annotation.value.toLowerCase() )).indexOf(query) > -1; }); @@ -1010,7 +1010,9 @@ Ox.VideoEditor = function(options, self) { var words = []; Ox.forEach(Ox.count(Ox.words( self.annotations.map(function(annotation) { - return Ox.decodeHTML(Ox.stripTags(annotation.value.toLowerCase())); + return Ox.decodeHTMLEntities( + Ox.stripTags(annotation.value.toLowerCase()) + ); }).join(' ') )), function(count, value) { words.push({count: count, value: value}); diff --git a/source/Ox.UI/js/Video/Ox.VideoPlayer.js b/source/Ox.UI/js/Video/Ox.VideoPlayer.js index dcffdbcf..dc6c247b 100644 --- a/source/Ox.UI/js/Video/Ox.VideoPlayer.js +++ b/source/Ox.UI/js/Video/Ox.VideoPlayer.js @@ -1173,7 +1173,7 @@ Ox.VideoPlayer = function(options, self) { if (query.length) { query = query.toLowerCase(); results = Ox.filter(self.options.annotations, function(annotation) { - return Ox.decodeHTML(Ox.stripTags( + return Ox.decodeHTMLEntities(Ox.stripTags( annotation.text.toLowerCase() )).indexOf(query) > -1; }).map(function(annotation) { @@ -1184,7 +1184,7 @@ Ox.VideoPlayer = function(options, self) { }; }) results = Ox.filter(self.options.annotations, function(annotation) { - return Ox.decodeHTML(Ox.stripTags( + return Ox.decodeHTMLEntities(Ox.stripTags( annotation.text.toLowerCase() )).indexOf(query) > -1; }).map(function(annotation) { diff --git a/source/Ox/js/JavaScript.js b/source/Ox/js/JavaScript.js index 54ccaca3..32b81fac 100644 --- a/source/Ox/js/JavaScript.js +++ b/source/Ox/js/JavaScript.js @@ -7,7 +7,7 @@ Ox.doc Generates documentation for annotated JavaScript Present if the type of the item is "function". description Multi-line description with optional markup - See Ox.parseHTML for details + See Ox.sanitizeHTML for details events <[o]|u> Events (array of doc objects) Present if the item fires any events file File name diff --git a/tests/js/tests.js b/tests/js/tests.js index f5ccb3b9..1279f887 100644 --- a/tests/js/tests.js +++ b/tests/js/tests.js @@ -75,10 +75,10 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() { }) .html( '' - + Ox.encodeHTML(test.statement) + ' ' + + Ox.encodeHTMLEntities(test.statement) + ' ' + (test.passed ? '=' : '!') + '=> ' - + Ox.encodeHTML(test.expected) - + (test.passed ? '' : ' ==> ' + Ox.encodeHTML(test.actual)) + + Ox.encodeHTMLEntities(test.expected) + + (test.passed ? '' : ' ==> ' + Ox.encodeHTMLEntities(test.actual)) + '' ) .appendTo($test.$content);