Ox.parseHTML -> Ox.sanitizeHTML, Ox.encodeHTML -> Ox.encodeHTMLEntities, Ox.decodeHTML -> Ox.decodeHTMLEntities
This commit is contained in:
parent
fef07dff6f
commit
c41afd2f5d
9 changed files with 28 additions and 26 deletions
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -88,7 +88,7 @@ Ox.DocPage = function(options, self) {
|
|||
'<code><b>' + (name || item.name) + '</b> '
|
||||
+ '<' + item.types.join('></code> or <code><') + '> </code>'
|
||||
+ (item['default'] ? '(default: <code>' + item['default'] + '</code>) ' : '')
|
||||
+ 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($('<div>')
|
||||
|
@ -160,7 +160,7 @@ Ox.DocPage = function(options, self) {
|
|||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code><b>> '
|
||||
+ Ox.encodeHTML(example.statement)
|
||||
+ Ox.encodeHTMLEntities(example.statement)
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/\n/g, '<br/>\n ')
|
||||
+ '</b></code>'
|
||||
|
@ -170,7 +170,7 @@ Ox.DocPage = function(options, self) {
|
|||
.addClass(className)
|
||||
.css({marginLeft: (level * 32 + 16) + 'px'})
|
||||
.html(
|
||||
'<code>' + Ox.encodeHTML(example.result) + '</code>'
|
||||
'<code>' + Ox.encodeHTMLEntities(example.result) + '</code>'
|
||||
)
|
||||
)
|
||||
});
|
||||
|
|
|
@ -71,7 +71,7 @@ Ox.SyntaxHighlighter = function(options, self) {
|
|||
}
|
||||
}
|
||||
source += '<span class="' + classNames + '">' +
|
||||
Ox.encodeHTML(token.value)
|
||||
Ox.encodeHTMLEntities(token.value)
|
||||
.replace(/ /g, whitespace)
|
||||
.replace(/\t/g, tab)
|
||||
.replace(/\n/g, linebreak) + '</span>';
|
||||
|
|
|
@ -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(/<br\/?><br\/?>/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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -7,7 +7,7 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
Present if the <code>type</code> of the item is
|
||||
<code>"function"</code>.
|
||||
description <s|u> 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 <s> File name
|
||||
|
|
|
@ -75,10 +75,10 @@ Ox.load({Geo: {}, UI: {}, Unicode: {}}, function() {
|
|||
})
|
||||
.html(
|
||||
'<span style="font-family: Monaco">'
|
||||
+ 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))
|
||||
+ '</tt>'
|
||||
)
|
||||
.appendTo($test.$content);
|
||||
|
|
Loading…
Reference in a new issue