swc/crates/swc_html_minifier/tests/fixture/element/script/input.html
2022-06-21 14:28:53 +00:00

186 lines
5.3 KiB
HTML

<!doctype html>
<html>
<head>
<title>Party Coffee Cake</title>
<!--[if lte IE 8]><script>
alert("ie8!" + "test")
</script><![endif]-->
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Party Coffee Cake",
"author": {
"@type": "Person",
"name": "Mary Stone"
},
"datePublished": "2018-03-10",
"description": "This coffee cake is awesome and perfect for parties.",
"prepTime": "PT20M"
}
</script>
<script type="application/ld+json" crossorigin="anonymous">
{
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Party Coffee Cake",
"author": {
"@type": "Person",
"name": "Mary Stone"
},
"datePublished": "2018-03-10",
"description": "This coffee cake is awesome and perfect for parties.",
"prepTime": "PT20M"
}
</script>
<script type="application/ld+json" crossorigin="anonymous">
{
broken
</script>
<script type="unknown">
{
"@context": "https://schema.org/",
"@type": "Recipe",
"name": "Party Coffee Cake",
"author": {
"@type": "Person",
"name": "Mary Stone"
},
"datePublished": "2018-03-10",
"description": "This coffee cake is awesome and perfect for parties.",
"prepTime": "PT20M"
}
</script>
<script type="speculationrules">
{
"prerender": [
{
"source": "list",
"urls": ["/page/2"],
"score": 0.5
},
{
"source": "document",
"if_href_matches": ["https://*.wikipedia.org/**"],
"if_not_selector_matches": [".restricted-section *"],
"score": 0.1
}
]
}
</script>
<script type="importmap">
{
"imports": {
"moment": "/node_modules/moment/src/moment.js",
"lodash": "/node_modules/lodash-es/lodash.js"
}
}
</script>
<script type="application/json" src="data.json"></script>
<script type="application/json" src="data.json">
</script>
<script id="data" type="application/json">
{
"foo" : "bar"
}
</script>
<script>
broken broken
</script>
<script type="application/ecmascript">
var a = 1 + 2;
</script>
<script type="application/ecmascript">
var a = 3 + 6;
</script>
<script type="module">
import foo from "foo.js";
const test = 140 * 420;
const test1 = "test" + "test";
</script>
<script>
let d = new Date();
alert("Today's date is " + d);
</script>
<script src="javascript.js">
</script>
<script src="javascript.js">
var q = "WRONG" ;
</script>
<script>
<!-- test -->
const foo = "test" + "test";
</script>
<script>alert('<!--')</script>
<script>alert('<!-- foo -->')</script>
<script>alert('-->')</script>
<script><!-- alert(1) --></script>
<script type="text/javascript">
// <![CDATA[
alert("test" + "test");
// ]]>
</script>
<script>function test(){ var foo = 1; var bar = 2; alert(foo + " " + bar); }</script>
<script>"test" + "test"</script>
</head>
<body>
<h2>Party coffee cake recipe</h2>
<p>
<i>by Mary Stone, 2018-03-10</i>
</p>
<p>
This coffee cake is awesome and perfect for parties.
</p>
<p>
Preparation time: 20 minutes
</p>
<svg>
<script>
alert("test")
</script>
<script type="application/javascript;version=1.8">alert(1)</script>
</svg>
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg">
<script>
// <![CDATA[
window.addEventListener('DOMContentLoaded', () => {
function getColor () {
const R = Math.round(Math.random() * 255).toString(16).padStart(2,'0')
const G = Math.round(Math.random() * 255).toString(16).padStart(2,'0')
const B = Math.round(Math.random() * 255).toString(16).padStart(2,'0')
return `#${R}${G}${B}`
}
document.querySelector('circle').addEventListener('click', (e) => {
e.target.style.fill = getColor()
})
})
// ]]>
</script>
<circle cx="5" cy="5" r="4" />
</svg>
<math>
<script>
// This is not script
alert('test')
</script>
</math>
</body>
</html>