diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-13 22:51:51 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-13 22:54:21 -0800 |
commit | 9fbc6267a4f6cd87c92fa6f57f437aacbac4fb72 (patch) | |
tree | dd80aa7af9614a75869102710022e8f7d2562b0a /js/lib/xml.js | |
parent | daf49a0089b9f5e342d3f6ee077d7e284eeb5c1c (diff) |
Initialize fields in objects to null rather than undefined.
Big speed boost.
Diffstat (limited to 'js/lib/xml.js')
-rw-r--r-- | js/lib/xml.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/js/lib/xml.js b/js/lib/xml.js index e867fdc..ada61f7 100644 --- a/js/lib/xml.js +++ b/js/lib/xml.js @@ -91,16 +91,16 @@ var renderNodes = function(block) { switch (nodetype) { case 'List': var data = node.list_data; - if (data.type !== undefined) { + if (data.type !== null) { attrs.push(['type', data.type.toLowerCase()]); } - if (data.start !== undefined) { + if (data.start !== null) { attrs.push(['start', String(data.start)]); } - if (data.tight !== undefined) { + if (data.tight !== null) { attrs.push(['tight', (data.tight ? 'true' : 'false')]); } - if (data.delimiter !== undefined) { + if (data.delimiter !== null) { var delimword = ''; if (data.delimiter === '.') { delimword = 'period'; @@ -128,7 +128,7 @@ var renderNodes = function(block) { } if (options.sourcepos) { var pos = node.sourcepos; - if (pos !== undefined) { + if (pos) { attrs.push(['data-sourcepos', String(pos[0][0]) + ':' + String(pos[0][1]) + '-' + String(pos[1][0]) + ':' + String(pos[1][1])]); |