/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/configCases/html/minimize-attributes/page.html
55 строк
2 KB
Alexander Akait
feat(minify): more safe CSS/HTML transforms, with the name tables generated (#21581)
02 авг 2026, 13:05
Не верифицирован
02 авг 2026, 13:05
23420d3
Код
Авторство
О чём код?
<!DOCTYPE html> <!-- An opening tag is rewritten from its own source spans, so the whitespace between attributes collapses to one space while every attribute keeps the quoting it was written with. Cases are ported from html-minifier-terser's `removing attribute quotes` and `keeping trailing slashes in tags` suites: the values it would unquote stay quoted here, because asset post-processors run regexes over emitted HTML *after* minification (webpack's own inline-script plugin is one) — which is also why html-minifier keeps `removeAttributeQuotes` off by default. --> <html lang="en"> <head> <title>Attribute corpus</title> </head> <body> <p title="blah" class="a23B-foo.bar_baz:qux" id="moo">removing attribute quotes</p> <input value="hello world"> <!-- upstream uses type="module"; webpack compiles module scripts, so this carries the same value-unquoting case on a script it leaves alone --> <script type="application/json">{"a":1}</script> <a href="#" title="foo#bar">x</a> <a href="http://example.test/" title="blah">trailing slash</a> <a title="blah" href="http://example.test/">trailing slash, last</a> <a href="http://example.test/" title="">empty value</a> <p class="foo|bar:baz">no quotes needed</p> <p onclick="x">event handler</p> <link href="<?php echo 'http://foo/' ?>"> <p data-gt="a>b" data-eq="a=b" data-lt="a<b" data-tick="a`b">must stay quoted</p> <p data-nl="a b">newline in a value</p> <p data-dq="a"b">double quote in a value</p> <p data-sq='a"b'>the other quote wins</p> <p data-amp="a?b&c" data-ref="a&b">raw value bytes</p> <input type="text" value="" disabled="disabled" checked> <div class="a" id="b" >collapsed attribute whitespace</div> <div >no attributes</div> <br /> <img src="data:image/gif;base64,R0lGOD" alt='say "hi"' /> <svg viewBox="0 0 8 8"><rect x="1" y="2"/><circle R="1"/></svg> <DIV CLASS="a">source casing</DIV> <p a=1 a=2>duplicate attribute</p> <p data-slash="/end/">value ending in a slash</p> <a href=x/>unquoted value ending in a slash</a> <pre> preformatted text </pre> <textarea class="t"> keep me </textarea> <!-- inert comment, dropped --> <!--[if IE]><p>kept: conditional comment</p><![endif]--> </body> <body class="merged-onto-the-open-body"> </html>