| OLD | NEW |
| (Empty) | |
| 1 <script> |
| 2 function clickHandler(errors, warnings) |
| 3 { |
| 4 return function() |
| 5 { |
| 6 for (var i = 0; i < errors; ++i) |
| 7 console.error("Error " + (i + 1)); |
| 8 for (var i = 0; i < warnings; ++i) |
| 9 console.warn("Warning " + (i + 1)); |
| 10 } |
| 11 } |
| 12 |
| 13 function loaded() |
| 14 { |
| 15 var tests = [ |
| 16 { errors: 0, warnings: 0 }, |
| 17 { errors: 1, warnings: 0 }, |
| 18 { errors: 2, warnings: 0 }, |
| 19 { errors: 0, warnings: 1 }, |
| 20 { errors: 0, warnings: 2 }, |
| 21 { errors: 1, warnings: 1 }, |
| 22 { errors: 1, warnings: 2 }, |
| 23 { errors: 2, warnings: 1 }, |
| 24 { errors: 2, warnings: 2 }, |
| 25 { errors: 100, warnings: 100 }, |
| 26 ]; |
| 27 |
| 28 for (var i in tests) { |
| 29 var test = tests[i]; |
| 30 |
| 31 var button = document.createElement("button"); |
| 32 var content = ""; |
| 33 if (!test.errors && !test.warnings) |
| 34 content = "(nothing)"; |
| 35 else { |
| 36 if (test.errors > 0) |
| 37 content += test.errors + " error" + (test.errors != 1 ? "s"
: ""); |
| 38 if (test.warnings > 0) { |
| 39 if (content.length) |
| 40 content += ", "; |
| 41 content += test.warnings + " warning" + (test.warnings != 1
? "s" : "") |
| 42 } |
| 43 } |
| 44 button.innerText = content; |
| 45 button.onclick = clickHandler(test.errors, test.warnings); |
| 46 var p = document.createElement("p"); |
| 47 p.appendChild(button); |
| 48 document.body.appendChild(p); |
| 49 } |
| 50 } |
| 51 </script> |
| 52 <body onload="loaded()"> |
| 53 <p>To begin test, open DevTools and click one of the buttons below. You should |
| 54 see an error and/or warning count in the Inspector's status bar. Clicking on |
| 55 the error/warning count should open the Console. Hovering over the |
| 56 error/warning count should show you a tooltip that matches the text in the |
| 57 button you clicked.</p> |
| 58 <p>Note: You must reload the page between each button press.</p> |
| OLD | NEW |