| <html> | |
| <head> | |
| <title>JSHint test</title> | |
| <script src="http://ajax.aspnetcdn.com/ajax/jshint/r07/jshint.js"></script> | |
| <style type="text/css"> | |
| .code { | |
| border: 1px solid gray; | |
| padding: 0.5em; | |
| font-size: 1em; | |
| width: 80%; | |
| font-family:monospace; } | |
| ul.results li { | |
| font-family:monospace; } | |
| </style> | |
| </head> | |
| <body> | |
| <h3>Test using JSHint r07 as library in web page</h3> | |
| <p><a href="https://gist.github.com/4573825">gist:4573825</a></p> | |
| <h3>Script Input</h3> | |
| <textarea id="code" class="code">function plus1(i) { return i + 1 }</textarea> | |
| <h3>JSHint Output</h3> | |
| <ul id="report-results" class="results"></ul> | |
| <script> | |
| var code = document.getElementById("code").value, | |
| reportResults = document.getElementById("report-results"), | |
| results = JSHINT(code); | |
| for (var i = 0; i < JSHINT.errors.length; ++i) { | |
| var err = JSHINT.errors[i]; | |
| if (!err) continue; | |
| var msg = document.createElement("li"); | |
| msg.innerText = err.reason; | |
| reportResults.appendChild(msg); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment