Skip to content

Commit

Permalink
Some code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fgnass committed Mar 11, 2011
1 parent eea5d02 commit ef3c34b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/jsdom/browser/htmlencoding.js
Expand Up @@ -125,10 +125,8 @@ function entityToChar(s, name) {
}

exports.HTMLDecode = function decode(s) {
if (s) {
s = s.replace(entityRegExp, entityToChar);
}
return s || '';
if (!s) return '';
return s.replace(entityRegExp, entityToChar);
};

function specialCharToEntity(s) {
Expand All @@ -137,8 +135,6 @@ function specialCharToEntity(s) {
}

exports.HTMLEncode = function encode(s) {
if (s) {
s = s.replace(specialCharRegExp, specialCharToEntity);
}
return s || '';
if (!s) return '';
return s.replace(specialCharRegExp, specialCharToEntity);
};

0 comments on commit ef3c34b

Please sign in to comment.