test for undefined

This commit is contained in:
rolux 2012-05-26 00:20:43 +02:00
parent 65c070d6b6
commit 5086c5da90

View file

@ -243,7 +243,8 @@ Ox.encodeHTML <f> HTML-encodes a string
'&#x00E4;b&#x00E7;d&#x00EA;'
@*/
Ox.encodeHTML = function(string) {
return Ox.map(string.toString(), function(char) {
string = Ox.isUndefined(string) ? '' : string.toString();
return Ox.map(string, function(char) {
var code = char.charCodeAt(0);
return code < 128
? (char in Ox.HTML_ENTITIES ? Ox.HTML_ENTITIES[char] : char)