-
Notifications
You must be signed in to change notification settings - Fork 7
/
example.html
33 lines (27 loc) · 1023 Bytes
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="tests/browserParser.js"></script>
<script type="text/javascript" src="xmlserializer.js"></script>
</head>
<body>
<textarea id="input" cols="80" rows="10" style="width: 600px; height: 250px"><p>An HTML document<br>with linebreaks<p>and more paragraphs.</textarea>
<pre id="output" style="width: 600px; min-height: 250px; white-space: pre-wrap; border: 1px solid grey;"></pre>
<script type="text/javascript">
var input = document.getElementById("input"),
output = document.getElementById("output"),
oldText = input.value;
function update() {
output.textContent = xmlserializer.serializeToString(parser.parse(input.value));
}
input.onkeyup = function () {
if (input.value !== oldText) {
oldText = input.value;
update();
}
};
update();
</script>
</body>
</html>