doc-pretty-print-inline-scripts.html (1756B)
1 <!-- This Source Code Form is subject to the terms of the Mozilla Public 2 - License, v. 2.0. If a copy of the MPL was not distributed with this 3 - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 4 <!doctype html> 5 6 <html> 7 <head> 8 <meta charset="utf-8"/> 9 <title>Debugger test page</title> 10 <!-- Added to check we don't handle non js scripts --> 11 <script id="json-data" type="application/json"> 12 { "foo": "bar" } 13 </script> 14 15 <!-- the unusual formatting is wanted to check inline scripts pretty printing --> 16 <script id="inline" type="application/javascript"> 17 18 19 20 const userInfo = JSON.parse(document.getElementById("json-data").text); console.log("User information: %o", userInfo); 21 document.addEventListener("click", function onClick(e){console.log("in inline script"); 22 // this is 23 // something 24 e.target; 25 }); 26 27 28 29 </script> 30 </head> 31 32 <body> 33 <h1>Minified</h1> 34 <!-- Checking that having empty inline scripts doesn't throw off pretty printing --> 35 <script></script> 36 <!-- Single line "minified" script --> 37 <script id="minified" type="module">for (const x of [42]){ if(x > 0){console.log(x,"yay")} else {console.log(x,"booh")} }</script> 38 <!-- Multiple line "minified" script, with content on the first line --> 39 <script>{"use strict";document.querySelector("h1").addEventListener( 40 "mousedown", e => {console.log("mousedown on h1")}) 41 }</script> 42 <hr><script>const x = {a:1, b:2};</script><hr><!-- multiple scripts on same line --><script>const y = [1,2,3];y.map(i => i*2)</script> 43 </body> 44 </html>