public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token) { switch(token.Name){ case "script": XmlElement currentNode = tree.CurrentNode as XmlElement; if(ElementInfo.IsSVGNameSpace(currentNode) && currentNode.Name == "script"){ tree.PopFromStack(); return; } break; } // Any Other End Tag XmlElement node = tree.CurrentNode as XmlElement; if(!token.IsEndTag(node.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } while(node != null){ if(token.IsEndTag(node.Name.ToLower())){ tree.StackOfOpenElements.PopUntilSameElement(node); break; } node = tree.StackOfOpenElements.GetAncestor(node); if(ElementInfo.IsHtmlNameSpace(node)) break; } tree.AppendToken(token); }
public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token) { if(token.IsEndTag("noscript")){ tree.PopFromStack(); tree.ChangeInsertionMode<InHeadInsertionMode>(); return; } if(token.IsEndTag("br")){ AppendAnythingElse(tree, token); return; } OnMessageRaised(new UnexpectedEndTagError(token.Name)); return; }
public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token) { if(token.IsEndTag("head")){ tree.PopFromStack(); tree.ChangeInsertionMode<AfterHeadInsertionMode>(); return; } if(token.IsEndTag("body", "html", "br")){ AppendAnythingElse(tree, token); return; } OnMessageRaised(new UnexpectedEndTagError()); return; }
public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token) { if(token.IsEndTag("body", "html", "br")){ AppendAnythingElse(tree, token); return; } OnMessageRaised(new UnexpectedEndTagError(token.Name)); return; }
public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token) { if(token.IsEndTag("body")){ if(!tree.StackOfOpenElements.HaveElementInScope("body")){ OnMessageRaised(new UnexpectedEndTagError(token.Name)); return; } string invalidOpenTag = tree.StackOfOpenElements.NotEither(myBodyEndTagPermitOpenTags); if(invalidOpenTag != null){ OnMessageRaised(new MissingEndTagError(invalidOpenTag)); } tree.ChangeInsertionMode<AfterBodyInsertionMode>(); return; } if(token.IsEndTag("html")){ EndTagHadBeSeen(tree, "body"); tree.ReprocessFlag = true; return; } if(token.IsEndTag("address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul")){ if(!tree.StackOfOpenElements.HaveElementInScope(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token); if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } tree.StackOfOpenElements.PopUntilSameTagName(token.Name); return; } if(token.IsEndTag("form")){ XmlElement node = tree.FormElementPointer; tree.FormElementPointer = null; if(node == null || !tree.StackOfOpenElements.Contains(node)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token); if(tree.CurrentNode != node){ OnMessageRaised(new LonlyEndTagError(token.Name)); } else { tree.StackOfOpenElements.Pop(); } return; } if(token.IsEndTag("p")){ EndTagPHadBeSeen(tree, token); return; } if(token.IsEndTag("li")){ if(!tree.StackOfOpenElements.HaveElementInListItemScope(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token, token.Name); if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } tree.StackOfOpenElements.PopUntilSameTagName(token.Name); return; } if(token.IsEndTag("dd", "dt")){ if(!tree.StackOfOpenElements.HaveElementInScope(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token, token.Name); if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } tree.StackOfOpenElements.PopUntilSameTagName(token.Name); return; } if(token.IsEndTag(myHeadingElements)){ if(!tree.StackOfOpenElements.HaveElementInScope(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token); if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } tree.StackOfOpenElements.PopUntilSameTagName(myHeadingElements); return; } if(token.IsEndTag("sarcasm")){ OnMessageRaised(new SarcasmEndTagInformation()); AnyOtherEndTag(tree, token); return; } if(token.IsEndTag("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")){ FormatEndTagHadBeSeen(tree, token, token.Name); return; } if(token.IsEndTag("applet", "marquee", "object")){ if(!tree.StackOfOpenElements.HaveElementInScope(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); return; } GenerateImpliedEndTags(tree, token); if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){ OnMessageRaised(new LonlyEndTagError(token.Name)); } tree.StackOfOpenElements.PopUntilSameTagName(token.Name); tree.ListOfActiveFormatElements.ClearUpToTheLastMarker(); return; } if(token.IsEndTag("br")){ OnMessageRaised(new BrEndTagError()); StartTagHadBeSeen(tree, "br"); return; } AnyOtherEndTag(tree, token); }