tree list: encode html entities

This commit is contained in:
rlx 2013-08-07 10:27:10 +00:00
parent 0d40620a68
commit 4b0b11e3d4

View file

@ -186,7 +186,7 @@ Ox.TreeList = function(options, self) {
function parseData(key, value) { function parseData(key, value) {
var ret = { var ret = {
id: Ox.uid().toString(), id: Ox.uid().toString(),
title: key.toString() + ': ' title: Ox.encodeHTMLEntities(key.toString()) + ': '
}, },
type = Ox.typeOf(value); type = Ox.typeOf(value);
if (type == 'array' || type == 'object') { if (type == 'array' || type == 'object') {
@ -202,8 +202,8 @@ Ox.TreeList = function(options, self) {
ret.title += ( ret.title += (
type == 'function' type == 'function'
? value.toString().split('{')[0] ? value.toString().split('{')[0]
: JSON.stringify(value) : Ox.encodeHTMLEntities(JSON.stringify(value))
.replace(/(^"|"$)/g, '<span class="OxLight">"</span>') .replace(/(^&quot;|&quot;$)/g, '<span class="OxLight">"</span>')
); );
} }
return ret; return ret;