aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-09 22:30:49 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-09 23:17:00 -0800
commit1f5e01bbacb790f8e1159d91d430e7bc023ffc98 (patch)
treec4c5e93a9232eb38385ca45949f22a1639d8e526
parent977a9dd1cd0e5574799211d697b0889431fc0876 (diff)
Use a switch instead of if-then-else.
-rw-r--r--js/lib/html.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/js/lib/html.js b/js/lib/html.js
index ce9b836..26c677b 100644
--- a/js/lib/html.js
+++ b/js/lib/html.js
@@ -228,15 +228,16 @@ var renderNodes = function(block, options) {
};
var sub = function(s) {
- if (s === '&') {
+ switch (s) {
+ case '&':
return '&amp;';
- } else if (s === '<') {
+ case '<':
return '&lt;';
- } else if (s === '>') {
+ case '>':
return '&gt;';
- } else if (s === '"') {
+ case '"':
return '&quot;';
- } else {
+ default:
return s;
}
};