Parent Directory
|
Revision Log
|
Patch
| revision 1.3 by wakaba, Sun Apr 20 10:02:43 2008 UTC | revision 1.15 by wakaba, Tue Apr 29 03:29:41 2008 UTC | |
|---|---|---|
| # | Line 1 | Line 1 |
| 1 | <!DOCTYPE HTML> | <!DOCTYPE HTML> |
| 2 | <html lang=en> | <html lang=en> |
| 3 | <head> | <head> |
| 4 | <title>Demo of HTML5 Parsing Algorithm with Scripting Enabled</title> | <title>Live Scripting HTML Parser</title> |
| 5 | <link rel=author href="http://suika.fam.cx/~wakaba/who?"> | |
| 6 | <link rel=license href="http://suika.fam.cx/c/gnu/gpl" | |
| 7 | title="GNU GPL2 or later"> | |
| 8 | <style> | <style> |
| 9 | h1 { | |
| 10 | margin: 0; | |
| 11 | font-size: 150%; | |
| 12 | } | |
| 13 | h2 { | |
| 14 | margin: 0; | |
| 15 | font-size: 100%; | |
| 16 | } | |
| 17 | p { | |
| 18 | margin: 0 1em; | |
| 19 | } | |
| 20 | textarea { | textarea { |
| 21 | display: block; | width: 100%; |
| 22 | width: 80%; | -width: 99%; |
| 23 | margin-left: auto; | height: 10em; |
| margin-right: auto; | ||
| min-height: 20em; | ||
| 24 | } | } |
| 25 | output { | output { |
| 26 | display: block; | display: block; |
| 27 | font-family: monospace; | font-family: monospace; |
| 28 | white-space: pre; | white-space: -moz-pre-wrap; |
| 29 | white-space: pre-wrap; | |
| 30 | } | } |
| 31 | </style> | </style> |
| 32 | <script> | <script> |
| 33 | var delayedUpdater = 0; | |
| 34 | ||
| 35 | function update () { | function update () { |
| 36 | document.logElement.textContent = ''; | if (delayedUpdater) { |
| 37 | var p = new Parser (new InputStream (document.sourceElement.value)); | clearTimeout (delayedUpdater); |
| 38 | p.parse (); | delayedUpdater = 0; |
| 39 | log (dumpTree (p.doc, '')); | } |
| 40 | delayedUpdater = setTimeout (update2, 100); | |
| 41 | } // update | } // update |
| 42 | ||
| 43 | function update2 () { | |
| 44 | var v = document.sourceElement.value; | |
| 45 | if (v != document.previousSourceText) { | |
| 46 |