/[suikacvs]/markup/html/scripting-parser/parser.html
Suika

Diff of /markup/html/scripting-parser/parser.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by wakaba, Fri Apr 25 13:42:51 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;
# Line 18  Line 23 
23    }    }
24  </style>  </style>
25  <script>  <script>
26      var delayedUpdater = 0;
27    
28    function update () {    function update () {
29        if (delayedUpdater) {
30          clearTimeout (delayedUpdater);
31          delayedUpdater = 0;
32        }
33        delayedUpdater = setTimeout (update2, 100);
34      } // update
35    
36      function update2 () {
37      document.logElement.textContent = '';      document.logElement.textContent = '';
38      var p = new Parser (new InputStream (document.sourceElement.value));      var v = document.sourceElement.value;
39        var p = new Parser (new InputStream (v));
40      var doc = p.doc;      var doc = p.doc;
41      p.parse ();      p.parse ();
42      log (dumpTree (doc, ''));      log (dumpTree (doc, ''));
43    } // update  
44        document.links['permalink'].href
45            = location.href + '?s=' + encodeURIComponent (v);
46      } // update2
47    
48    var logIndentLevel = 0;    var logIndentLevel = 0;
49    function log (s) {    function log (s) {
# Line 235  Line 254 
254            this.openElements[this.openElements.length - 1].appendChild (el);            this.openElements[this.openElements.length - 1].appendChild (el);
255    
256            // 11. Let the insertion point have the value of the old ...            // 11. Let the insertion point have the value of the old ...
257    
258            oldInsertionPoint += this.insertionPoint;            oldInsertionPoint += this.insertionPoint;
259            this.setInsertionPoint (oldInsertionPoint);            this.setInsertionPoint (oldInsertionPoint);
260    
# Line 634  Line 654 
654    document.logElement = document.getElementsByTagName ('output')[0];    document.logElement = document.getElementsByTagName ('output')[0];
655    update ();    update ();
656  ">  ">
657    <h1>Live Scripting Parser</h1>
658    
659  <textarea onchange=" update () ">&lt;html>  <h2>Markup to test
660    (<a href=data:, id=permalink rel=bookmark>permalink</a>)</h2>
661    <p>
662    <textarea onkeydown=" update () " onchange=" update () " oninput=" update () ">&lt;html>
663  &lt;head>&lt;/head>&lt;body>  &lt;head>&lt;/head>&lt;body>
664  &lt;p>  &lt;p>
665  &lt;script>  &lt;script>
# Line 644  document.write ('aaaaaaa&lt;/p>&lt;scrip Line 668  document.write ('aaaaaaa&lt;/p>&lt;scrip
668  &lt;p>  &lt;p>
669  </textarea>  </textarea>
670    
671  <output></output>  <h2>Log</h2>
672    <p><output></output>
673    
674    <!-- TODO: short description -->
675    
676    <!-- TODO: permalink query -> textarea -->
677    
678    <!-- TODO: multiple attributes are not supported yet -->
679    
680  </body>  </body>
681  </html>  </html>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24