mirror of
https://github.com/beautifier/js-beautify.git
synced 2024-11-23 12:49:40 +00:00
parent
b48652465a
commit
68f6494dd0
@ -141,7 +141,7 @@ var get_type_attribute = function(start_token) {
|
||||
var raw_token = start_token.next;
|
||||
|
||||
// Search attributes for a type attribute
|
||||
while (raw_token.type !== TOKEN.EOF && raw_token.closed !== start_token) {
|
||||
while (raw_token.type !== TOKEN.EOF && start_token.closed !== raw_token) {
|
||||
if (raw_token.type === TOKEN.ATTRIBUTE && raw_token.text === 'type') {
|
||||
if (raw_token.next && raw_token.next.type === TOKEN.EQUALS &&
|
||||
raw_token.next.next && raw_token.next.next.type === TOKEN.VALUE) {
|
||||
|
@ -479,6 +479,20 @@ function run_html_tests(test_obj, Urlencoded, js_beautify, html_beautify, css_be
|
||||
'<script>\n' +
|
||||
' var foo = "bar";\n' +
|
||||
'</script>');
|
||||
|
||||
// Issue #1606 - type attribute on other element
|
||||
bth(
|
||||
'<script>\n' +
|
||||
'console.log(1 + 1);\n' +
|
||||
'</script>\n' +
|
||||
'\n' +
|
||||
'<input type="submit"></input>',
|
||||
// -- output --
|
||||
'<script>\n' +
|
||||
' console.log(1 + 1);\n' +
|
||||
'</script>\n' +
|
||||
'\n' +
|
||||
'<input type="submit"></input>');
|
||||
bth(
|
||||
'<script type="text/javascript">var foo = "bar";</script>',
|
||||
// -- output --
|
||||
|
@ -282,6 +282,22 @@ exports.test_data = {
|
||||
' var foo = "bar";',
|
||||
'</script>'
|
||||
]
|
||||
}, {
|
||||
comment: 'Issue #1606 - type attribute on other element',
|
||||
input: [
|
||||
'<script>',
|
||||
'console.log(1 + 1);',
|
||||
'</script>',
|
||||
'',
|
||||
'<input type="submit"></input>'
|
||||
],
|
||||
output: [
|
||||
'<script>',
|
||||
' console.log(1 + 1);',
|
||||
'</script>',
|
||||
'',
|
||||
'<input type="submit"></input>'
|
||||
]
|
||||
}, {
|
||||
input: '<script type="text/javascript">var foo = "bar";</script>',
|
||||
output: [
|
||||
|
Loading…
Reference in New Issue
Block a user