feat(html/minifier): Compress title (#5320)

This commit is contained in:
Alexander Akait 2022-07-28 04:30:44 +03:00 committed by GitHub
parent 02af4aa196
commit 6ad5b3ce5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View File

@ -2260,6 +2260,9 @@ impl VisitMut for Minifier<'_> {
text_type = Some(MinifierType::Css)
}
}
"title" if current_element.namespace == Namespace::HTML => {
n.data = self.collapse_whitespace(&n.data).trim().into();
}
_ => {}
}
}

View File

@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<title>
Test
Test
</title>
</head>
<body>
<div>test</div>
</body>
</html>

View File

@ -0,0 +1 @@
<!doctype html><html lang=en><title>Test Test</title><div>test</div>

View File

@ -1,7 +1,4 @@
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>
Document
</title><p>
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><p>
test
</p>