|
5 | 5 | <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> |
6 | 6 | </head> |
7 | 7 | <body> |
8 | | - <div class="container"> |
| 8 | + <div class="container" style="padding-top:30px"> |
9 | 9 |
|
10 | 10 | <div class="row"> |
11 | | - <div class="hero-unit span12"> |
| 11 | + <div class="span12"> |
| 12 | + <div class="hero-unit"> |
12 | 13 | <h1>Pure JavaScript HTML Parser</h1> |
13 | 14 | <p>All-in-one: XML Serializer, DOM Builder, DOM Document Creator, A SAX-style API </p> |
14 | 15 | <p> |
15 | 16 | <a class="btn btn-primary btn-large" href="https://github.com/blowsie/Pure-JavaScript-HTML-Parser">Learn more |
16 | 17 | </a> |
17 | 18 | </p> |
18 | 19 | </div> |
19 | | - |
| 20 | + </div> |
20 | 21 | </div> |
21 | 22 | <div class="row"> |
22 | | - <div class="span8"> |
23 | | - <form id="form"> |
24 | | - <label>Input (HTML):</label><br /> |
25 | | - <textarea cols="60" rows="10" id="input" style="width: 100%;"></textarea><br /> |
26 | | - <input type="submit" value="Run" /> |
27 | | - </form> |
28 | | - <br /> |
29 | | - <label>Output (XML):</label><br /> |
30 | | - <textarea cols="60" rows="10" id="output" style="width: 100%;"></textarea> |
| 23 | + <div class="span5"> |
| 24 | + <div style="padding: 10px"> |
| 25 | + <form id="form"> |
| 26 | + <label>Input (HTML):</label><br /> |
| 27 | + <textarea cols="60" rows="10" id="input" style="width: 100%;"></textarea><br /> |
| 28 | + <input type="submit" value="Run" class="btn btn-primary" /> |
| 29 | + </form> |
| 30 | + <br /> |
| 31 | + <label>Output (XML):</label><br /> |
| 32 | + <textarea cols="60" rows="10" id="output" style="width: 100%;"></textarea> |
| 33 | + </div> |
31 | 34 | </div> |
32 | | - <div class="span4"> |
33 | | - While this library doesn't cover the full gamut of possible weirdness that HTML provides, it does handle a lot of the most obvious stuff. All of the following are accounted for: |
34 | | - |
35 | | - |
36 | | - <ul> |
37 | | - <li>Unclosed Tags: |
38 | | - <pre>HTMLtoXML("<p><b>Hello") == '<p><b>Hello</b></p>'</pre> |
39 | | - </li> |
40 | | - <li>Empty Elements: |
41 | | - <pre>HTMLtoXML("<img src=test.jpg>") == '<img src="test.jpg"/>'</pre> |
42 | | - </li> |
43 | | - <li>Block vs. Inline Elements: |
44 | | - <pre>HTMLtoXML("<b>Hello <p>John") == '<b>Hello </b><p>John</p>'</pre> |
45 | | - </li> |
46 | | - <li>Self-closing Elements: |
47 | | - <pre>HTMLtoXML("<p>Hello<p>World") == '<p>Hello</p><p>World</p>'</pre> |
48 | | - </li> |
49 | | - <li>Attributes Without Values: |
50 | | - <pre>HTMLtoXML("<input disabled>") == '<input disabled="disabled"/>'</pre> |
51 | | - </li> |
52 | | - </ul> |
53 | | - |
54 | | - <b>Note:</b> It does <b>not</b> take into account where in the document an element should exist. Right now you can put block elements in a head or th inside a p and it'll happily accept them. It's not entirely clear how the logic should work for those, but it's something that I'm open to exploring. |
| 35 | + <div class="span7"> |
| 36 | + <div style="padding: 10px"> |
| 37 | + <p>While this library doesn't cover the full gamut of possible weirdness that HTML provides, it does handle a lot of the most obvious stuff. All of the following are accounted for:</p> |
| 38 | + <ul> |
| 39 | + <li>Unclosed Tags: |
| 40 | + <pre>HTMLtoXML("<p><b>Hello") == '<p><b>Hello</b></p>'</pre> |
| 41 | + </li> |
| 42 | + <li>Empty Elements: |
| 43 | + <pre>HTMLtoXML("<img src=test.jpg>") == '<img src="test.jpg"/>'</pre> |
| 44 | + </li> |
| 45 | + <li>Block vs. Inline Elements: |
| 46 | + <pre>HTMLtoXML("<b>Hello <p>John") == '<b>Hello </b><p>John</p>'</pre> |
| 47 | + </li> |
| 48 | + <li>Self-closing Elements: |
| 49 | + <pre>HTMLtoXML("<p>Hello<p>World") == '<p>Hello</p><p>World</p>'</pre> |
| 50 | + </li> |
| 51 | + <li>Attributes Without Values: |
| 52 | + <pre>HTMLtoXML("<input disabled>") == '<input disabled="disabled"/>'</pre> |
| 53 | + </li> |
| 54 | + </ul> |
| 55 | + <br /> |
| 56 | + <div class="alert alert-info"><b>Note:</b> It does <b>not</b> take into account where in the document an element should exist. Right now you can put block elements in a head or th inside a p and it'll happily accept them. It's not entirely clear how the logic should work for those, but it's something that I'm open to exploring.</div> |
| 57 | + </div> |
55 | 58 | </div> |
56 | 59 | </div> |
57 | 60 |
|
58 | 61 | </div> |
59 | | - <script src="/htmlparser.js"></script> |
| 62 | + <script src="htmlparser.js"></script> |
60 | 63 | <script> |
61 | 64 | window.onload = function () { |
62 | 65 | var input = document.getElementById("input"); |
|
0 commit comments