-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html/minifier): Add
collapse_boolean_attributes
option (#4960)
- Loading branch information
1 parent
5c60464
commit 3957bc6
Showing
7 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/attribute/boolean-keep/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"collapseBooleanAttributes": false | ||
} |
41 changes: 41 additions & 0 deletions
41
crates/swc_html_minifier/tests/fixture/attribute/boolean-keep/input.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
|
||
<p><button autofocus value="next">Button</button></p> | ||
<p><button autofocus="autofocus" value="next">Button</button></p> | ||
<p><button autofocus=" autofocus " value="next">Button</button></p> | ||
<p><button autofocus="true" value="next">Button</button></p> | ||
<p><button autofocus="false" value="next">Button</button></p> | ||
|
||
<img draggable="false"> | ||
<img draggable="true"> | ||
|
||
<img data-readonly="test"> | ||
|
||
<input disabled="disabled"> | ||
<input CHECKED = "checked" readonly="readonly"> | ||
<option name="blah" selected="selected">moo</option> | ||
<input autofocus="autofocus"> | ||
<input required="required"> | ||
<input multiple="multiple"> | ||
<div Allowfullscreen=foo Async=foo Autofocus=foo Autoplay=foo Checked=foo Compact=foo Controls=foo Declare=foo Default=foo Defaultchecked=foo Defaultmuted=foo Defaultselected=foo Defer=foo Disabled=foo Enabled=foo Formnovalidate=foo Hidden=foo Indeterminate=foo Inert=foo Ismap=foo Itemscope=foo Loop=foo Multiple=foo Muted=foo Nohref=foo Noresize=foo Noshade=foo Novalidate=foo Nowrap=foo Open=foo Pauseonexit=foo Readonly=foo Required=foo Reversed=foo Scoped=foo Seamless=foo Selected=foo Sortable=foo Truespeed=foo Typemustmatch=foo Visible=foo></div> | ||
<div Allowfullscreen Async Autofocus Autoplay Checked Compact Controls Declare Default Defaultchecked Defaultmuted Defaultselected Defer Disabled Enabled Formnovalidate Hidden Indeterminate Inert Ismap Itemscope Loop Multiple Muted Nohref Noresize Noshade Novalidate Nowrap Open Pauseonexit Readonly Required Reversed Scoped Seamless Selected Sortable Truespeed Typemustmatch Visible></div> | ||
|
||
<div draggable="auto"></div> | ||
<div draggable="true"></div> | ||
<div draggable="false"></div> | ||
<div draggable="foo"></div> | ||
<div draggable></div> | ||
<div Draggable="auto"></div> | ||
<div Draggable="true"></div> | ||
<div Draggable="false"></div> | ||
<div Draggable="foo"></div> | ||
<div Draggable></div> | ||
<div draggable="Auto"></div> | ||
|
||
</body> | ||
</html> |
35 changes: 35 additions & 0 deletions
35
crates/swc_html_minifier/tests/fixture/attribute/boolean-keep/output.min.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype html><html lang=en><title>Document</title><body> | ||
|
||
<p><button autofocus value=next>Button</button></p> | ||
<p><button autofocus=autofocus value=next>Button</button></p> | ||
<p><button autofocus=" autofocus " value=next>Button</button></p> | ||
<p><button autofocus=true value=next>Button</button></p> | ||
<p><button autofocus=false value=next>Button</button></p> | ||
|
||
<img draggable=false> | ||
<img draggable=true> | ||
|
||
<img data-readonly=test> | ||
|
||
<input disabled=disabled> | ||
<input checked=checked readonly=readonly> | ||
<option name=blah selected=selected>moo</option> | ||
<input autofocus=autofocus> | ||
<input required=required> | ||
<input multiple=multiple> | ||
<div allowfullscreen=foo async=foo autofocus=foo autoplay=foo checked=foo compact=foo controls=foo declare=foo default=foo defaultchecked=foo defaultmuted=foo defaultselected=foo defer=foo disabled=foo enabled=foo formnovalidate=foo hidden=foo indeterminate=foo inert=foo ismap=foo itemscope=foo loop=foo multiple=foo muted=foo nohref=foo noresize=foo noshade=foo novalidate=foo nowrap=foo open=foo pauseonexit=foo readonly=foo required=foo reversed=foo scoped=foo seamless=foo selected=foo sortable=foo truespeed=foo typemustmatch=foo visible=foo></div> | ||
<div allowfullscreen async autofocus autoplay checked compact controls declare default defaultchecked defaultmuted defaultselected defer disabled enabled formnovalidate hidden indeterminate inert ismap itemscope loop multiple muted nohref noresize noshade novalidate nowrap open pauseonexit readonly required reversed scoped seamless selected sortable truespeed typemustmatch visible></div> | ||
|
||
<div draggable=auto></div> | ||
<div draggable=true></div> | ||
<div draggable=false></div> | ||
<div draggable=foo></div> | ||
<div draggable></div> | ||
<div draggable=auto></div> | ||
<div draggable=true></div> | ||
<div draggable=false></div> | ||
<div draggable=foo></div> | ||
<div draggable></div> | ||
<div draggable=Auto></div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters