diff --git a/js/lib/beautify-html.js b/js/lib/beautify-html.js index 4d2a87c34..c9344d659 100644 --- a/js/lib/beautify-html.js +++ b/js/lib/beautify-html.js @@ -405,6 +405,18 @@ this.indent_content = true; this.traverse_whitespace(); } + } else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags + comment = this.get_unformatted('', tag_complete); //...delegate to get_unformatted function + content.push(comment); + // Preserve collapsed whitespace either before or after this tag. + if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)) { + content.splice(0, 0, this.input.charAt(tag_start - 1)); + } + tag_end = this.pos - 1; + if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)) { + content.push(this.input.charAt(tag_end + 1)); + } + this.tag_type = 'SINGLE'; } else if (tag_check === 'script' && (tag_complete.search('type') === -1 || (tag_complete.search('type') > -1 && @@ -420,18 +432,6 @@ this.record_tag(tag_check); this.tag_type = 'STYLE'; } - } else if (this.is_unformatted(tag_check, unformatted)) { // do not reformat the "unformatted" tags - comment = this.get_unformatted('', tag_complete); //...delegate to get_unformatted function - content.push(comment); - // Preserve collapsed whitespace either before or after this tag. - if (tag_start > 0 && this.Utils.in_array(this.input.charAt(tag_start - 1), this.Utils.whitespace)) { - content.splice(0, 0, this.input.charAt(tag_start - 1)); - } - tag_end = this.pos - 1; - if (this.Utils.in_array(this.input.charAt(tag_end + 1), this.Utils.whitespace)) { - content.push(this.input.charAt(tag_end + 1)); - } - this.tag_type = 'SINGLE'; } else if (tag_check.charAt(0) === '!') { //peek for '); // END tests for issue 453 - + + var unformatted = opts.unformatted; + opts.unformatted = ['script', 'style']; + bth(''); + bth(''); + opts.unformatted = unformatted; + // Tests that don't pass, but probably should. // bth('
content
');