Skip to content

Commit 10923c6

Browse files
committed
Html fixes.
1 parent 1a39869 commit 10923c6

1 file changed

Lines changed: 39 additions & 36 deletions

File tree

demo.html

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,61 @@
55
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
66
</head>
77
<body>
8-
<div class="container">
8+
<div class="container" style="padding-top:30px">
99

1010
<div class="row">
11-
<div class="hero-unit span12">
11+
<div class="span12">
12+
<div class="hero-unit">
1213
<h1>Pure JavaScript HTML Parser</h1>
1314
<p>All-in-one: XML Serializer, DOM Builder, DOM Document Creator, A SAX-style API </p>
1415
<p>
1516
<a class="btn btn-primary btn-large" href="https://github.com/blowsie/Pure-JavaScript-HTML-Parser">Learn more
1617
</a>
1718
</p>
1819
</div>
19-
20+
</div>
2021
</div>
2122
<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>
3134
</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("&lt;p>&lt;b>Hello") == '&lt;p>&lt;b>Hello&lt;/b>&lt;/p>'</pre>
39-
</li>
40-
<li>Empty Elements:
41-
<pre>HTMLtoXML("&lt;img src=test.jpg>") == '&lt;img src="test.jpg"/>'</pre>
42-
</li>
43-
<li>Block vs. Inline Elements:
44-
<pre>HTMLtoXML("&lt;b>Hello &lt;p>John") == '&lt;b>Hello &lt;/b>&lt;p>John&lt;/p>'</pre>
45-
</li>
46-
<li>Self-closing Elements:
47-
<pre>HTMLtoXML("&lt;p>Hello&lt;p>World") == '&lt;p>Hello&lt;/p>&lt;p>World&lt;/p>'</pre>
48-
</li>
49-
<li>Attributes Without Values:
50-
<pre>HTMLtoXML("&lt;input disabled>") == '&lt;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("&lt;p>&lt;b>Hello") == '&lt;p>&lt;b>Hello&lt;/b>&lt;/p>'</pre>
41+
</li>
42+
<li>Empty Elements:
43+
<pre>HTMLtoXML("&lt;img src=test.jpg>") == '&lt;img src="test.jpg"/>'</pre>
44+
</li>
45+
<li>Block vs. Inline Elements:
46+
<pre>HTMLtoXML("&lt;b>Hello &lt;p>John") == '&lt;b>Hello &lt;/b>&lt;p>John&lt;/p>'</pre>
47+
</li>
48+
<li>Self-closing Elements:
49+
<pre>HTMLtoXML("&lt;p>Hello&lt;p>World") == '&lt;p>Hello&lt;/p>&lt;p>World&lt;/p>'</pre>
50+
</li>
51+
<li>Attributes Without Values:
52+
<pre>HTMLtoXML("&lt;input disabled>") == '&lt;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>
5558
</div>
5659
</div>
5760

5861
</div>
59-
<script src="/htmlparser.js"></script>
62+
<script src="htmlparser.js"></script>
6063
<script>
6164
window.onload = function () {
6265
var input = document.getElementById("input");

0 commit comments

Comments
 (0)