From e68459f9557cb70b8df9eafea60de19aa2552537 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 9 Jan 2015 11:06:06 -0800 Subject: JS linter improvements. (Note: this is helping performance. We have regained everything we lost with the last major change, and more.) --- js/lib/html.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/js/lib/html.js b/js/lib/html.js index e7953cf..045ab54 100644 --- a/js/lib/html.js +++ b/js/lib/html.js @@ -1,3 +1,5 @@ +"use strict"; + // Helper function to produce an HTML tag. var tag = function(name, attribs, selfclosing) { var result = '<' + name; @@ -9,8 +11,9 @@ var tag = function(name, attribs, selfclosing) { i++; } } - if (selfclosing) + if (selfclosing) { result += ' /'; + } result += '>'; return result; @@ -28,19 +31,19 @@ var renderNodes = function(block) { var grandparent; var out = function(s) { if (disableTags > 0) { - buffer.push(s.replace(/\<[^>]*\>/g, '')); + buffer.push(s.replace(/\<[^>]*\>/g, '')); } else { buffer.push(s); } - } + }; var esc = this.escape; var cr = function() { if (buffer.length > 0 && buffer[buffer.length - 1] !== '\n') { out('\n'); } - } + }; - while (event = walker.next()) { + while ((event = walker.next())) { entering = event.entering; node = event.node; @@ -88,14 +91,14 @@ var renderNodes = function(block) { case 'Image': if (entering) { - if (disableTags == 0) { + if (disableTags === 0) { out('');
                 }
                 disableTags += 1;
             } else {
                 disableTags -= 1;
-                if (disableTags == 0) {
+                if (disableTags === 0) {
                     if (node.title) {
                         out(']/g, '>') .replace(/["]/g, '"'); -- cgit v1.2.3