From bdb9837076fb72e8b9479e1d5264b5cff20728ef Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Fri, 29 Jun 2018 20:45:02 -0700 Subject: [PATCH] Minor additional tweaks --- js/lib/beautify-html.js | 7 ++++--- js/src/html/beautifier.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/lib/beautify-html.js b/js/lib/beautify-html.js index a7a22db87..c90e55f35 100644 --- a/js/lib/beautify-html.js +++ b/js/lib/beautify-html.js @@ -795,7 +795,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) { } // only need to search for custom delimiter for the first few characters - if (!matched && comment.length < 10) { + if (!matched) { + matched = comment.length > 10; if (comment.indexOf(''; matched = true; @@ -1041,8 +1042,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) { } multi_parser.print_token(token.text); if (multi_parser.indent_content) { - if ((multi_parser.indent_body_inner_html || !token.text.match(//)) && - (multi_parser.indent_head_inner_html || !token.text.match(//))) { + if ((multi_parser.indent_body_inner_html || token.tag_name !== 'body') && + (multi_parser.indent_head_inner_html || token.tag_name !== 'head')) { multi_parser.indent(); } diff --git a/js/src/html/beautifier.js b/js/src/html/beautifier.js index b216f526f..3be7a614d 100644 --- a/js/src/html/beautifier.js +++ b/js/src/html/beautifier.js @@ -646,7 +646,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) { } // only need to search for custom delimiter for the first few characters - if (!matched && comment.length < 10) { + if (!matched) { + matched = comment.length > 10; if (comment.indexOf(''; matched = true; @@ -892,8 +893,8 @@ function Beautifier(html_source, options, js_beautify, css_beautify) { } multi_parser.print_token(token.text); if (multi_parser.indent_content) { - if ((multi_parser.indent_body_inner_html || !token.text.match(//)) && - (multi_parser.indent_head_inner_html || !token.text.match(//))) { + if ((multi_parser.indent_body_inner_html || token.tag_name !== 'body') && + (multi_parser.indent_head_inner_html || token.tag_name !== 'head')) { multi_parser.indent(); }