/[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.7 by wakaba, Fri Apr 25 23:03:35 2008 UTC revision 1.9 by wakaba, Sun Apr 27 09:16:11 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  <style>  <style>
6    h1, h2 {    h1, h2 {
7      margin: 0;      margin: 0;
# Line 34  Line 34 
34    } // update    } // update
35    
36    function update2 () {    function update2 () {
     document.logElement.textContent = '';  
37      var v = document.sourceElement.value;      var v = document.sourceElement.value;
38      var p = new Parser (new InputStream (v));      if (v != document.previousSourceText) {
39      var doc = p.doc;        document.previousSourceText = v;
40      p.parse ();        document.links['permalink'].href
41      log (dumpTree (doc, ''));            = location.pathname + '?s=' + encodeURIComponent (v);
42          document.links['ldvlink'].href
43      document.links['permalink'].href            = 'http://software.hixie.ch/utilities/js/live-dom-viewer/?'
44          = location.href + '?s=' + encodeURIComponent (v);            + encodeURIComponent (v);
45    
46          document.logElement.textContent = '';
47          var p = new Parser (new InputStream (v));
48          var doc = p.doc;
49          p.parse ();
50          log (dumpTree (doc, ''));
51        }
52    } // update2    } // update2
53    
54    var logIndentLevel = 0;    var logIndentLevel = 0;
# Line 65  Line 71 
71      }      }
72      this.doc = doc;      this.doc = doc;
73      this.openElements = [doc];      this.openElements = [doc];
74      this.in = i;      this.input = i;
75      this.scriptsExecutedAfterParsing = [];      this.scriptsExecutedAfterParsing = [];
76    } // Parser    } // Parser
77    
78    Parser.prototype.getNextToken = function () {    Parser.prototype.getNextToken = function () {
79      var p = this;      var p = this;
80      var i = this.in;      var i = this.input;
81