示例#1
0
            public override bool Process(Token t, TreeBuilder tb)
            {
                if (IsWhitespace(t))
                {
                    return true; // ignore whitespace
                }
                else if (t.IsComment())
                {
                    tb.Insert(t.AsComment());
                }
                else if (t.IsDoctype())
                {
                    // todo: parse error check on expected doctypes
                    // todo: quirk state check on doctype ids
                    Token.Doctype d = t.AsDoctype();
                    DocumentType doctype = new DocumentType(d.Name.ToString(), d.PublicIdentifier.ToString(), d.SystemIdentifier.ToString(), tb.BaseUri.ToString());
                    tb.Document.AppendChild(doctype);

                    if (d.ForceQuirks)
                    {
                        tb.Document.QuirksMode(Document.QuirksModeEnum.Quirks);
                    }
                    tb.Transition(BeforeHtml);
                }
                else
                {
                    // todo: check not iframe srcdoc
                    tb.Transition(BeforeHtml);
                    return tb.Process(t); // re-process token
                }
                return true;
            }
示例#2
0
 public void Insert(Token.Doctype d)
 {
     DocumentType doctypeNode = new DocumentType(d.Name.ToString(), d.PublicIdentifier.ToString(), d.SystemIdentifier.ToString(), _baseUri);
     InsertNode(doctypeNode);
 }