Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-beautify

Package Overview
Dependencies
Maintainers
2
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-beautify - npm Package Compare versions

Comparing version 1.6.3 to 1.6.4

js/test/resources/editorconfig/.editorconfig

40

CHANGELOG.md
# Changelog
## v1.6.4
### Description
* Fixed JSX multi-line root element handling
* Fixed CSS Combinator spacing (NOTE: use `space_around_combinator` option)
* Fixed (more) CSS pseudo-class and pseudo-element selectors (Thanks @Konamiman!)
* Fixed Shorthand generator functions and `yield*` (Thanks @jgeurts!)
* Added EditorConfig support (Thanks @ethanluoyc!)
* Added indent_body_inner_html and indent_head_inner_html (Thanks @spontaliku-softaria!)
* Added js-beautify to https://cdn.rawgit.com (Thanks @zxqfox)
### Closed Issues
* css-beautify sibling combinator space issue ([#1001](https://github.com/beautify-web/js-beautify/issues/1001))
* Bug: Breaks when the source code it found an unclosed multiline comment. ([#996](https://github.com/beautify-web/js-beautify/issues/996))
* CSS: Preserve white space before pseudo-class and pseudo-element selectors ([#985](https://github.com/beautify-web/js-beautify/pull/985))
* Spelling error in token definition ([#984](https://github.com/beautify-web/js-beautify/issues/984))
* collapse-preserve-inline does not preserve simple, single line ("return") statements ([#982](https://github.com/beautify-web/js-beautify/issues/982))
* Publish the library via cdn ([#971](https://github.com/beautify-web/js-beautify/issues/971))
* Bug with css calc() function ([#957](https://github.com/beautify-web/js-beautify/issues/957))
* &:first-of-type:not(:last-child) when prettified insert erroneous white character ([#952](https://github.com/beautify-web/js-beautify/issues/952))
* Shorthand generator functions are formatting strangely ([#941](https://github.com/beautify-web/js-beautify/issues/941))
* Add handlebars support on cli for html ([#935](https://github.com/beautify-web/js-beautify/pull/935))
* Do not put a space within `yield*` generator functions. ([#920](https://github.com/beautify-web/js-beautify/issues/920))
* Possible to add an indent_inner_inner_html option? (Prevent indenting second-level tags) ([#917](https://github.com/beautify-web/js-beautify/issues/917))
* Messing up jsx formatting ([#914](https://github.com/beautify-web/js-beautify/issues/914))
* Bug report: Closing 'body' tag isn't formatted correctly ([#900](https://github.com/beautify-web/js-beautify/issues/900))
* { throw … } not working with collapse-preserve-inline ([#898](https://github.com/beautify-web/js-beautify/issues/898))
* ES6 concise method not propely indented ([#889](https://github.com/beautify-web/js-beautify/issues/889))
* CSS beautify changing symantics ([#883](https://github.com/beautify-web/js-beautify/issues/883))
* Dojo unsupported script types. ([#874](https://github.com/beautify-web/js-beautify/issues/874))
* Readme version comment ([#868](https://github.com/beautify-web/js-beautify/issues/868))
* space in media queries after colon &: selectors ([#565](https://github.com/beautify-web/js-beautify/issues/565))
* Integrating editor config ([#551](https://github.com/beautify-web/js-beautify/issues/551))
* Preserve short expressions/statements on single line ([#338](https://github.com/beautify-web/js-beautify/issues/338))
## v1.6.3

@@ -3,0 +43,0 @@

23

js/lib/beautify-css.js

@@ -77,3 +77,4 @@ /*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */

var newline_between_rules = (options.newline_between_rules === undefined) ? true : options.newline_between_rules;
var spaceAroundSelectorSeparator = (options.space_around_selector_separator === undefined) ? false : options.space_around_selector_separator;
var space_around_combinator = (options.space_around_combinator === undefined) ? false : options.space_around_combinator;
space_around_combinator = space_around_combinator || ((options.space_around_selector_separator === undefined) ? false : options.space_around_selector_separator);
var eol = options.eol ? options.eol : '\n';

@@ -376,3 +377,4 @@

if ((insideRule || enteringConditionalGroup) &&
!(lookBack("&") || foundNestedPseudoClass())) {
!(lookBack("&") || foundNestedPseudoClass()) &&
!lookBack("(")) {
// 'property: value' delimiter

@@ -386,2 +388,7 @@ // which could be in a conditional group query

// sass nested pseudo-class don't use a space
// preserve space before pseudoclasses/pseudoelements, as it means "in any child"
if (lookBack(" ") && output[output.length - 1] !== " ") {
output.push(" ");
}
if (peek() === ":") {

@@ -431,5 +438,6 @@ // pseudo-element

}
} else if (ch === '>' || ch === '+' || ch === '~') {
//handl selector separator spacing
if (spaceAroundSelectorSeparator && !insidePropertyValue && parenLevel < 1) {
} else if ((ch === '>' || ch === '+' || ch === '~') &&
!insidePropertyValue && parenLevel < 1) {
//handle combinator spacing
if (space_around_combinator) {
print.singleSpace();

@@ -440,2 +448,7 @@ output.push(ch);

output.push(ch);
eatWhitespace();
// squash extra whitespace
if (ch && whiteRe.test(ch)) {
ch = '';
}
}

@@ -442,0 +455,0 @@ } else if (ch === ']') {

@@ -92,2 +92,4 @@ /*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */

indent_inner_html,
indent_body_inner_html,
indent_head_inner_html,
indent_size,

@@ -116,2 +118,4 @@ indent_character,

indent_inner_html = (options.indent_inner_html === undefined) ? false : options.indent_inner_html;
indent_body_inner_html = (options.indent_body_inner_html === undefined) ? true : options.indent_body_inner_html;
indent_head_inner_html = (options.indent_head_inner_html === undefined) ? true : options.indent_head_inner_html;
indent_size = (options.indent_size === undefined) ? 4 : parseInt(options.indent_size, 10);

@@ -132,3 +136,2 @@ indent_character = (options.indent_char === undefined) ? ' ' : options.indent_char;

'pre',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
];

@@ -169,2 +172,4 @@ preserve_newlines = (options.preserve_newlines === undefined) ? true : options.preserve_newlines;

this.indent_content = indent_inner_html;
this.indent_body_inner_html = indent_body_inner_html;
this.indent_head_inner_html = indent_head_inner_html;

@@ -506,3 +511,3 @@ this.Utils = { //Uilities made available to the various functions

(tag_complete.search('type') > -1 &&
tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json)/) > -1))) {
tag_complete.search(/\b(text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect)/) > -1))) {
if (!peek) {

@@ -855,3 +860,8 @@ this.record_tag(tag_check);

if (multi_parser.indent_content) {
multi_parser.indent();
if ((multi_parser.indent_body_inner_html || !multi_parser.token_text.match(/<body(?:.*)>/)) &&
(multi_parser.indent_head_inner_html || !multi_parser.token_text.match(/<head(?:.*)>/))) {
multi_parser.indent();
}
multi_parser.indent_content = false;

@@ -870,3 +880,3 @@ }

if (multi_parser.last_token === 'TK_CONTENT' && multi_parser.last_text === '') {
var tag_name = multi_parser.token_text.match(/\w+/)[0];
var tag_name = (multi_parser.token_text.match(/\w+/) || [])[0];
var tag_extracted_from_last_output = null;

@@ -873,0 +883,0 @@ if (multi_parser.output.length) {

@@ -45,2 +45,3 @@ #!/usr/bin/env node

path = require('path'),
editorconfig = require('editorconfig'),
knownOpts = {

@@ -74,2 +75,4 @@ // Beautifier

"newline_between_rules": Boolean,
"space_around_combinator": Boolean,
//deprecated - replaced with space_around_combinator, remove in future version
"space_around_selector_separator": Boolean,

@@ -80,2 +83,3 @@ // HTML-only

"indent_inner_html": [Boolean],
"indent_handlebars": [Boolean],
"indent_scripts": ["keep", "separate", "normal"],

@@ -91,3 +95,4 @@ "extra_liners": [String, Array],

"type": ["js", "css", "html"],
"config": path
"config": path,
"editorconfig": Boolean
},

@@ -127,2 +132,3 @@ // dasherizeShorthands provides { "indent-size": ["--indent_size"] }

"I": ["--indent_inner_html"],
"H": ["--indent_handlebars"],
"S": ["--indent_scripts"],

@@ -147,2 +153,3 @@ "E": ["--extra_liners"],

// no shorthand for "config"
// no shorthand for "editorconfig"
});

@@ -174,2 +181,44 @@

function set_file_editorconfig_opts(file, config) {
try {
var eConfigs = editorconfig.parseSync(file);
if (eConfigs.indent_style === "tab") {
config.indent_with_tabs = true;
} else if (eConfigs.indent_style === "space") {
config.indent_with_tabs = false;
}
if (eConfigs.indent_size) {
config.indent_size = eConfigs.indent_size;
}
if (eConfigs.max_line_length) {
if (eConfigs.max_line_length === "off") {
config.wrap_line_length = 0;
} else {
config.wrap_line_length = parseInt(eConfigs.max_line_length);
}
}
if (eConfigs.insert_final_newline === true) {
config.end_with_newline = true;
} else if (eConfigs.insert_final_newline === false) {
config.end_with_newline = false;
}
if (eConfigs.end_of_line) {
if (eConfigs.end_of_line === 'cr') {
config.eol = '\r';
} else if (eConfigs.end_of_line === 'lf') {
config.eol = '\n';
} else if (eConfigs.end_of_line === 'crlf') {
config.eol = '\r\n';
}
}
} catch (e) {
debug(e);
}
}
// var cli = require('js-beautify/cli'); cli.interpret();

@@ -251,3 +300,4 @@ var interpret = exports.interpret = function(argv, slice) {

' [first newline in file, otherwise "\\n]',
' -n, --end-with-newline End output with newline'
' -n, --end-with-newline End output with newline',
' --editorconfig Use EditorConfig to set up the options'
];

@@ -277,2 +327,3 @@

msg.push(' -I, --indent-inner-html Indent body and head sections. Default is false.');
msg.push(' -H, --indent-handlebars Indent handlebars. Default is false.');
msg.push(' -S, --indent-scripts [keep|separate|normal] ["normal"]');

@@ -325,5 +376,13 @@ msg.push(' -w, --wrap-line-length Wrap lines at next opportunity after N characters [0]');

input.on('end', function() {
makePretty(data, config, outfile, writePretty);
makePretty(data, config, outfile, writePretty); // Where things get beautified
});
} else {
// Only enable editorconfig with files (stdin not suppored).
if (config.editorconfig) {
debug("EditorConfig is enabled for ", filepath);
config = cc(config).snapshot;
set_file_editorconfig_opts(filepath, config);
debug(config);
}
if (outfile) {

@@ -330,0 +389,0 @@ mkdirp.sync(path.dirname(outfile));

@@ -31,2 +31,3 @@ /*

default_opts.newline_between_rules = false;
default_opts.space_around_combinator = false;
default_opts.space_around_selector_separator = false;

@@ -124,4 +125,4 @@

//============================================================
// Space Around Selector Separator - (space = " ")
opts.space_around_selector_separator = true;
// Space Around Combinator - (space = " ")
opts.space_around_combinator = true;
t('a>b{}', 'a > b {}');

@@ -131,5 +132,29 @@ t('a~b{}', 'a ~ b {}');

t('a+b>c{}', 'a + b > c {}');
t('a > b{}', 'a > b {}');
t('a ~ b{}', 'a ~ b {}');
t('a + b{}', 'a + b {}');
t('a + b > c{}', 'a + b > c {}');
t(
'a > b{width: calc(100% + 45px);}',
'a > b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a ~ b{width: calc(100% + 45px);}',
'a ~ b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b{width: calc(100% + 45px);}',
'a + b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b > c{width: calc(100% + 45px);}',
'a + b > c {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
// Space Around Selector Separator - (space = "")
opts.space_around_selector_separator = false;
// Space Around Combinator - (space = "")
opts.space_around_combinator = false;
t('a>b{}', 'a>b {}');

@@ -139,4 +164,59 @@ t('a~b{}', 'a~b {}');

t('a+b>c{}', 'a+b>c {}');
t('a > b{}', 'a>b {}');
t('a ~ b{}', 'a~b {}');
t('a + b{}', 'a+b {}');
t('a + b > c{}', 'a+b>c {}');
t(
'a > b{width: calc(100% + 45px);}',
'a>b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a ~ b{width: calc(100% + 45px);}',
'a~b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b{width: calc(100% + 45px);}',
'a+b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b > c{width: calc(100% + 45px);}',
'a+b>c {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
// Space Around Combinator - (space = " ")
opts.space_around_selector_separator = true;
t('a>b{}', 'a > b {}');
t('a~b{}', 'a ~ b {}');
t('a+b{}', 'a + b {}');
t('a+b>c{}', 'a + b > c {}');
t('a > b{}', 'a > b {}');
t('a ~ b{}', 'a ~ b {}');
t('a + b{}', 'a + b {}');
t('a + b > c{}', 'a + b > c {}');
t(
'a > b{width: calc(100% + 45px);}',
'a > b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a ~ b{width: calc(100% + 45px);}',
'a ~ b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b{width: calc(100% + 45px);}',
'a + b {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
t(
'a + b > c{width: calc(100% + 45px);}',
'a + b > c {\n' +
'\twidth: calc(100% + 45px);\n' +
'}');
reset_options();

@@ -289,2 +369,11 @@ //============================================================

'}');
// Multiple filed issues in LESS due to not(:blah)
t('&:first-of-type:not(:last-child) {}');
t(
'div {\n' +
'\t&:not(:first-of-type) {\n' +
'\t\tbackground: red;\n' +
'\t}\n' +
'}');

@@ -294,2 +383,36 @@

//============================================================
// Proper handling of colon in selectors
opts.selector_separator_newline = false;
t('a :b {}');
t('a ::b {}');
t('a:b {}');
t('a::b {}');
t('a {}, a::b {}, a ::b {}, a:b {}, a :b {}', 'a {}\n, a::b {}\n, a ::b {}\n, a:b {}\n, a :b {}');
t(
'.card-blue ::-webkit-input-placeholder {\n' +
'\tcolor: #87D1FF;\n' +
'}');
t(
'div [attr] :not(.class) {\n' +
'\tcolor: red;\n' +
'}');
reset_options();
//============================================================
// Regresssion Tests
opts.selector_separator_newline = false;
t(
'@media(min-width:768px) {\n' +
'\t.selector::after {\n' +
'\t\t/* property: value */\n' +
'\t}\n' +
'\t.other-selector {\n' +
'\t\t/* property: value */\n' +
'\t}\n' +
'}');
reset_options();
//============================================================
//

@@ -296,0 +419,0 @@

@@ -99,2 +99,13 @@ /*

//============================================================
// Handle inline and block elements differently - ()
test_fragment(
'<body><h1>Block</h1></body>',
'<body>\n' +
' <h1>Block</h1>\n' +
'</body>');
test_fragment('<body><i>Inline</i></body>');
reset_options();
//============================================================
// End With Newline - (eof = "\n")

@@ -190,2 +201,12 @@ opts.end_with_newline = true;

bth(
'<script type="dojo/aspect">this.domNode.style.display="none";</script>',
'<script type="dojo/aspect">\n' +
' this.domNode.style.display = "none";\n' +
'</script>');
bth(
'<script type="dojo/method">this.domNode.style.display="none";</script>',
'<script type="dojo/method">\n' +
' this.domNode.style.display = "none";\n' +
'</script>');
bth(
'<script type="text/javascript1.5">var foo = "bar";</script>',

@@ -567,3 +588,3 @@ '<script type="text/javascript1.5">\n' +

// Php formatting
test_fragment('<h1 class="content-page-header"><?=$view["name"]; ?></h1>');
test_fragment('<h1 class="content-page-header"><?=$view["name"]; ?></h1>', '<h1 class="content-page-header">\n <?=$view["name"]; ?>\n</h1>');
test_fragment(

@@ -620,2 +641,28 @@ '<?php\n' +

//============================================================
// Indent body inner html by default
test_fragment('<html>\n<body>\n<div></div>\n</body>\n\n</html>', '<html>\n<body>\n <div></div>\n</body>\n\n</html>');
reset_options();
//============================================================
// indent_body_inner_html set to false prevents indent of body inner html
opts.indent_body_inner_html = false;
test_fragment('<html>\n<body>\n<div></div>\n</body>\n\n</html>');
reset_options();
//============================================================
// Indent head inner html by default
test_fragment('<html>\n\n<head>\n<meta>\n</head>\n\n</html>', '<html>\n\n<head>\n <meta>\n</head>\n\n</html>');
reset_options();
//============================================================
// indent_head_inner_html set to false prevents indent of head inner html
opts.indent_head_inner_html = false;
test_fragment('<html>\n\n<head>\n<meta>\n</head>\n\n</html>');
reset_options();
//============================================================
// New Test Suite

@@ -622,0 +669,0 @@

{
"name": "js-beautify",
"version": "1.6.3",
"version": "1.6.4",
"description": "jsbeautifier.org for node",

@@ -42,2 +42,3 @@ "main": "js/index.js",

"config-chain": "~1.1.5",
"editorconfig": "^0.13.2",
"mkdirp": "~0.5.0",

@@ -44,0 +45,0 @@ "nopt": "~3.0.1"

@@ -19,2 +19,10 @@ # JS Beautifier

To use in web browser include the script tag below in your document
```html
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/1.6.4/js/lib/beautify.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/1.6.4/js/lib/beautify-css.js"></script>
<script src="https://cdn.rawgit.com/beautify-web/js-beautify/1.6.4/js/lib/beautify-html.js"></script>
```
Disclaimer: It's a free service, so there are [no uptime or support guarantees](https://github.com/rgrove/rawgit/wiki/Frequently-Asked-Questions#i-need-guaranteed-100-uptime-should-i-use-cdnrawgitcom).
## Web Browser

@@ -111,2 +119,3 @@ Open [jsbeautifier.org](http://jsbeautifier.org/). Options are available via the UI.

--good-stuff Warm the cockles of Crockford's heart
--editorconfig Use EditorConfig to set up the options
```

@@ -154,3 +163,3 @@

Beautifier for supports directives in comments inside the file.
This allows you to tell the beautifier to preserve the formtatting of or completely ignore part of a file.
This allows you to tell the beautifier to preserve the formtatting of or completely ignore part of a file.
The example input below will remain changed after beautification

@@ -168,3 +177,3 @@

// Use ignore when the content is not parsable as javascript.
// Use ignore when the content is not parsable as javascript.
var a = 1;

@@ -218,2 +227,3 @@ /* beautify ignore:start */

-E, --extra_liners List of tags (defaults to [head,body,/html] that should have an extra newline before them.
--editorconfig Use EditorConfig to set up the options
```

@@ -237,2 +247,2 @@

js-beautify@1.6.0-0
(README.md: js-beautify@1.6.3)

@@ -8,2 +8,4 @@ exports.test_data = {

{ name: "newline_between_rules", value: "false" },
{ name: "space_around_combinator", value: "false" },
// deprecated
{ name: "space_around_selector_separator", value: "false" }

@@ -49,10 +51,14 @@ ],

}, {
name: "Space Around Selector Separator",
name: "Space Around Combinator",
description: "",
matrix: [{
options: [{ name: "space_around_selector_separator", value: "true" }],
options: [{ name: "space_around_combinator", value: "true" }],
space: ' '
}, {
options: [{ name: "space_around_selector_separator", value: "false" }],
options: [{ name: "space_around_combinator", value: "false" }],
space: ''
}, {
// space_around_selector_separator is deprecated, but needs to keep working for now.
options: [{ name: "space_around_selector_separator", value: "true" }],
space: ' '
}],

@@ -63,3 +69,39 @@ tests: [

{ input: 'a+b{}', output: 'a{{space}}+{{space}}b {}' },
{ input: 'a+b>c{}', output: 'a{{space}}+{{space}}b{{space}}>{{space}}c {}' }
{ input: 'a+b>c{}', output: 'a{{space}}+{{space}}b{{space}}>{{space}}c {}' },
{ input: 'a > b{}', output: 'a{{space}}>{{space}}b {}' },
{ input: 'a ~ b{}', output: 'a{{space}}~{{space}}b {}' },
{ input: 'a + b{}', output: 'a{{space}}+{{space}}b {}' },
{ input: 'a + b > c{}', output: 'a{{space}}+{{space}}b{{space}}>{{space}}c {}' },
{
input: 'a > b{width: calc(100% + 45px);}',
output: [
'a{{space}}>{{space}}b {',
'\twidth: calc(100% + 45px);',
'}'
]
},
{
input: 'a ~ b{width: calc(100% + 45px);}',
output: [
'a{{space}}~{{space}}b {',
'\twidth: calc(100% + 45px);',
'}'
]
},
{
input: 'a + b{width: calc(100% + 45px);}',
output: [
'a{{space}}+{{space}}b {',
'\twidth: calc(100% + 45px);',
'}'
]
},
{
input: 'a + b > c{width: calc(100% + 45px);}',
output: [
'a{{space}}+{{space}}b{{space}}>{{space}}c {',
'\twidth: calc(100% + 45px);',
'}'
]
}
]

@@ -224,7 +266,65 @@ }, {

]
},
{
comment: "Multiple filed issues in LESS due to not(:blah)",
unchanged: '&:first-of-type:not(:last-child) {}'
},
{
unchanged: [
'div {',
'\t&:not(:first-of-type) {',
'\t\tbackground: red;',
'\t}',
'}',
]
}
],
}, {
name: "Proper handling of colon in selectors",
description: "Space before a colon in a selector must be preserved, as it means pseudoclass/pseudoelement on any child",
options: [{ name: "selector_separator_newline", value: "false" }],
tests: [
{ unchanged: 'a :b {}' },
{ unchanged: 'a ::b {}' },
{ unchanged: 'a:b {}' },
{ unchanged: 'a::b {}' },
{
input: 'a {}, a::b {}, a ::b {}, a:b {}, a :b {}',
output: 'a {}\n, a::b {}\n, a ::b {}\n, a:b {}\n, a :b {}'
},
{
unchanged: [
'.card-blue ::-webkit-input-placeholder {',
'\tcolor: #87D1FF;',
'}'
]
},
{
unchanged: [
'div [attr] :not(.class) {',
'\tcolor: red;',
'}'
]
}
]
}, {
name: "Regresssion Tests",
description: "General Regression tests for known issues",
options: [{ name: "selector_separator_newline", value: "false" }],
tests: [{
unchanged: [
'@media(min-width:768px) {',
'\t.selector::after {',
'\t\t/* property: value */',
'\t}',
'\t.other-selector {',
'\t\t/* property: value */',
'\t}',
'}'
]
}]
}, {
}]
};

@@ -13,2 +13,18 @@ exports.test_data = {

groups: [{
name: "Handle inline and block elements differently",
description: "",
matrix: [{}],
tests: [{
fragment: true,
input: '<body><h1>Block</h1></body>',
output: [
'<body>',
' <h1>Block</h1>',
'</body>'
]
}, {
fragment: true,
unchanged: '<body><i>Inline</i></body>'
}]
}, {
name: "End With Newline",

@@ -162,2 +178,16 @@ description: "",

}, {
input: '<script type="dojo/aspect">this.domNode.style.display="none";</script>',
output: [
'<script type="dojo/aspect">',
' this.domNode.style.display = "none";',
'</script>'
]
}, {
input: '<script type="dojo/method">this.domNode.style.display="none";</script>',
output: [
'<script type="dojo/method">',
' this.domNode.style.display = "none";',
'</script>'
]
}, {
input: '<script type="text/javascript1.5">var foo = "bar";</script>',

@@ -560,29 +590,31 @@ output: [

options: [],
tests: [
{ fragment: true, unchanged: '<h1 class="content-page-header"><?=$view["name"]; ?></h1>' }, {
fragment: true,
unchanged: [
'<?php',
'for($i = 1; $i <= 100; $i++;) {',
' #count to 100!',
' echo($i . "</br>");',
'}',
'?>'
]
}, {
fragment: true,
unchanged: [
'<?php ?>',
'<!DOCTYPE html>',
'',
'<html>',
'',
'<head></head>',
'',
'<body></body>',
'',
'</html>'
]
}
]
tests: [{
fragment: true,
input: '<h1 class="content-page-header"><?=$view["name"]; ?></h1>',
output: '<h1 class="content-page-header">\n <?=$view["name"]; ?>\n</h1>',
}, {
fragment: true,
unchanged: [
'<?php',
'for($i = 1; $i <= 100; $i++;) {',
' #count to 100!',
' echo($i . "</br>");',
'}',
'?>'
]
}, {
fragment: true,
unchanged: [
'<?php ?>',
'<!DOCTYPE html>',
'',
'<html>',
'',
'<head></head>',
'',
'<body></body>',
'',
'</html>'
]
}]
}, {

@@ -639,4 +671,40 @@ name: "underscore.js formatting",

}, {
name: "Indent body inner html by default",
description: "",
tests: [{
fragment: true,
input: '<html>\n<body>\n<div></div>\n</body>\n\n</html>',
output: '<html>\n<body>\n <div></div>\n</body>\n\n</html>'
}]
}, {
name: "indent_body_inner_html set to false prevents indent of body inner html",
description: "",
options: [
{ name: 'indent_body_inner_html', value: "false" }
],
tests: [{
fragment: true,
unchanged: '<html>\n<body>\n<div></div>\n</body>\n\n</html>'
}]
}, {
name: "Indent head inner html by default",
description: "",
tests: [{
fragment: true,
input: '<html>\n\n<head>\n<meta>\n</head>\n\n</html>',
output: '<html>\n\n<head>\n <meta>\n</head>\n\n</html>'
}]
}, {
name: "indent_head_inner_html set to false prevents indent of head inner html",
description: "",
options: [
{ name: 'indent_head_inner_html', value: "false" }
],
tests: [{
fragment: true,
unchanged: '<html>\n\n<head>\n<meta>\n</head>\n\n</html>'
}]
}, {
name: "New Test Suite"
}],
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc