Parent Directory
|
Revision Log
|
Patch
| revision 1.1 by wakaba, Sun Apr 20 06:07:24 2008 UTC | revision 1.7 by wakaba, Fri Apr 25 23:03:35 2008 UTC | |
|---|---|---|
| # | Line 3 | Line 3 |
| 3 | <head> | <head> |
| 4 | <title>Demo of HTML5 Parsing Algorithm with Scripting Enabled</title> | <title>Demo of HTML5 Parsing Algorithm with Scripting Enabled</title> |
| 5 | <style> | <style> |
| 6 | h1, h2 { | |
| 7 | margin: 0; | |
| 8 | font-size: 100%; | |
| 9 | } | |
| 10 | p, pre { | |
| 11 | margin: 0; | |
| 12 | } | |
| 13 | textarea { | textarea { |
| 14 | display: block; | width: 100%; |
| 15 | width: 80%; | -width: 99%; |
| 16 | margin-left: auto; | height: 10em; |
| margin-right: auto; | ||
| min-height: 20em; | ||
| 17 | } | } |
| 18 | output { | output { |
| 19 | display: block; | display: block; |
| 20 | font-family: monospace; | font-family: monospace; |
| 21 | white-space: pre; | white-space: -moz-pre-wrap; |
| 22 | white-space: pre-wrap; | |
| 23 | } | } |
| 24 | </style> | </style> |
| 25 | <script> | <script> |
| 26 | var delayedUpdater = 0; | |
| 27 | ||
| 28 | function update () { | function update () { |
| 29 | document.logElement.textContent = ''; | if (delayedUpdater) { |
| 30 | var p = new Parser (); | clearTimeout (delayedUpdater); |
| 31 | p.parse (new InputStream (document.sourceElement.value)); | delayedUpdater = 0; |
| 32 | log (dumpTree (p.doc, '')); | } |
| 33 | delayedUpdater = setTimeout (update2, 100); | |
| 34 | } // update | } // update |
| 35 | ||
| 36 | function update2 () { | |
| 37 | document.logElement.textContent = ''; | |
| 38 | var v = document.sourceElement.value; | |
| 39 | var p = new Parser (new InputStream (v)); | |
| 40 | var doc = p.doc; | |
| 41 | p.parse (); | |
| 42 | log (dumpTree (doc, '')); | |
| 43 | ||
| 44 | document.links['permalink'].href | |
| 45 | = location.href + '?s=' + encodeURIComponent (v); | |
| 46 | } // update2 | |
| 47 | ||
| 48 | var logIndentLevel = 0; | |