コード例 #1
0
ファイル: HtmlTreeBuilder.cs プロジェクト: Carbonfrost/f-html
 private void InsertNode(DomNode node)
 {
     // if the stack hasn't been set up yet, elements (doctype, comments) go into the doc
     if (stack.Count == 0)
     {
         doc.Append(node);
     }
     else if (IsFosterInserts())
     {
         InsertInFosterParent(node);
     }
     else
     {
         CurrentElement.Append(node);
     }
 }
コード例 #2
0
ファイル: HtmlTreeBuilder.cs プロジェクト: Carbonfrost/f-html
        public void Insert(Token.Character characterToken)
        {
            DomNode node;

            // characters in script and style go in as datanodes, not text nodes
            if (CurrentElement.NodeName.In("script", "style"))
            {
                node = new HtmlText(characterToken.Data, true);
            }
            else
            {
                node = new HtmlText(characterToken.Data);
            }

            CurrentElement.Append(node); // doesn't use insertNode, because we don't foster these; and will always have a stack.
        }