本文整理汇总了C#中Tidy.Core.Node.IsDescendantOf方法的典型用法代码示例。如果您正苦于以下问题:C# Node.IsDescendantOf方法的具体用法?C# Node.IsDescendantOf怎么用?C# Node.IsDescendantOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tidy.Core.Node
的用法示例。
在下文中一共展示了Node.IsDescendantOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
/*
element is node created by the lexer
upon seeing the start tag, or by the
parser when the start tag is inferred
*/
public virtual void Parse(Lexer lexer, Node element, short mode)
{
Node node;
bool checkstack;
int istackbase = 0;
TagCollection tt = lexer.Options.TagTable;
checkstack = true;
if ((element.Tag.Model & ContentModel.EMPTY) != 0)
{
return;
}
if (element.Tag == tt.TagForm && element.IsDescendantOf(tt.TagForm))
{
Report.Warning(lexer, element, null, Report.ILLEGAL_NESTING);
}
/*
InlineDup() asks the lexer to insert inline emphasis tags
currently pushed on the istack, but take care to avoid
propagating inline emphasis inside OBJECT or APPLET.
For these elements a fresh inline stack context is created
and disposed of upon reaching the end of the element.
They thus behave like table cells in this respect.
*/
if ((element.Tag.Model & ContentModel.OBJECT) != 0)
{
istackbase = lexer.Istackbase;
lexer.Istackbase = lexer.Istack.Count;
}
if ((element.Tag.Model & ContentModel.MIXED) == 0)
{
lexer.InlineDup(null);
}
mode = Lexer.IGNORE_WHITESPACE;
while (true)
{
node = lexer.GetToken(mode);
if (node == null)
{
break;
}
/* end tag for this element */
if (node.Type == Node.END_TAG && node.Tag != null &&
(node.Tag == element.Tag || element.Was == node.Tag))
{
if ((element.Tag.Model & ContentModel.OBJECT) != 0)
{
/* pop inline stack */
while (lexer.Istack.Count > lexer.Istackbase)
{
lexer.PopInline(null);
}
lexer.Istackbase = istackbase;
}
element.Closed = true;
Node.TrimSpaces(lexer, element);
Node.TrimEmptyElement(lexer, element);
return;
}
if (node.Tag == tt.TagHtml || node.Tag == tt.TagHead || node.Tag == tt.TagBody)
{
if (node.Type == Node.START_TAG || node.Type == Node.START_END_TAG)
{
Report.Warning(lexer, element, node, Report.DISCARDING_UNEXPECTED);
}
continue;
}
if (node.Type == Node.END_TAG)
{
if (node.Tag == null)
{
Report.Warning(lexer, element, node, Report.DISCARDING_UNEXPECTED);
continue;
}
if (node.Tag == tt.TagBr)
{
node.Type = Node.START_TAG;
}
else if (node.Tag == tt.TagP)
{
Node.CoerceNode(lexer, node, tt.TagBr);
Node.InsertNodeAtEnd(element, node);
node = lexer.InferredTag("br");
//.........这里部分代码省略.........