From 9fbc6267a4f6cd87c92fa6f57f437aacbac4fb72 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 13 Jan 2015 22:51:51 -0800 Subject: Initialize fields in objects to null rather than undefined. Big speed boost. --- js/lib/xml.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/lib/xml.js') 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])]); -- cgit v1.2.3