diff --git a/js/src/html/beautifier.js b/js/src/html/beautifier.js
index e9727813d..b8c4591f7 100644
--- a/js/src/html/beautifier.js
+++ b/js/src/html/beautifier.js
@@ -159,7 +159,7 @@ var get_custom_beautifier_name = function(tag_check, raw_token) {
// For those without a type attribute use default;
if (typeAttribute.search('text/css') > -1) {
result = 'css';
- } else if (typeAttribute.search(/(text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect)/) > -1) {
+ } else if (typeAttribute.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/) > -1) {
result = 'javascript';
} else if (typeAttribute.search(/(text|application|dojo)\/(x-)?(html)/) > -1) {
result = 'html';
diff --git a/js/test/generated/beautify-html-tests.js b/js/test/generated/beautify-html-tests.js
index e726ec6e4..f7c01d80b 100644
--- a/js/test/generated/beautify-html-tests.js
+++ b/js/test/generated/beautify-html-tests.js
@@ -670,10 +670,18 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
'\n' +
'');
bth(
- '',
+ '',
// -- output --
'');
+
+ // Issue #1706 - es script module
+ bth(
+ '',
+ // -- output --
+ '');
bth(
'',
diff --git a/test/data/html/tests.js b/test/data/html/tests.js
index 3d97119d2..29df67073 100644
--- a/test/data/html/tests.js
+++ b/test/data/html/tests.js
@@ -516,10 +516,18 @@ exports.test_data = {
''
]
}, {
- input: '',
+ input: '',
output: [
''
+ ]
+ }, {
+ comment: 'Issue #1706 - es script module',
+ input: '',
+ output: [
+ ''
]
}, {