Exemple #1
0
        public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
        {
            switch(token.Name){
            case "optgroup":
                if(tree.StackOfOpenElements.IsCurrentNameMatch("option")){
                    XmlElement immediatelyBeforeNode = tree.StackOfOpenElements.GetImmediatelyBeforeCurrentNode();
                    if(immediatelyBeforeNode.Name == "optgroup"){
                        AppendEndTagToken(tree, new FakeEndTagToken(){Name = "option"});
                    }
                }
                if(tree.StackOfOpenElements.IsCurrentNameMatch("optgroup")){
                    tree.PopFromStack();
                } else {
                    OnMessageRaised(new LonlyEndTagError(token.Name));
                    return;
                }
                return;

            case "option":
                if(tree.StackOfOpenElements.IsCurrentNameMatch("option")){
                    tree.PopFromStack();
                } else {
                    OnMessageRaised(new LonlyEndTagError(token.Name));
                    return;
                }
                return;

            case "select":
                tree.StackOfOpenElements.PopUntilSameTagName("select");
                tree.ResetInsertionModeAppropriately();
                return;

            }
            AppendAnythingElse(tree, token);
        }
Exemple #2
0
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "table":
         if(!tree.StackOfOpenElements.HaveElementInTableScope(token.Name)){
             OnMessageRaised(new LonlyEndTagError(token.Name));
             return;
         }
         tree.StackOfOpenElements.PopUntilSameTagName(token.Name);
         tree.ResetInsertionModeAppropriately();
         return;
     case "body":
     case "caption":
     case "col":
     case "colgroup":
     case "html":
     case "tbody":
     case "td":
     case "tfoot":
     case "th":
     case "thead":
     case "tr":
         OnMessageRaised(new UnexpectedEndTagError(token.Name));
         return;
     }
     AppendAnythingElse(tree, token);
 }
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "caption":
         GenerateImpliedEndTags(tree, token);
         if(!tree.StackOfOpenElements.IsCurrentNameMatch(token.Name)){
             OnMessageRaised(new LonlyEndTagError(token.Name));
         }
         tree.StackOfOpenElements.PopUntilSameTagName(token.Name);
         tree.ListOfActiveFormatElements.ClearUpToTheLastMarker();
         tree.ChangeInsertionMode<InTableInsertionMode>();
         return;
     case "table":
         OnMessageRaised(new UnexpectedEndTagError(token.Name));
         AppendEndTagToken(tree, new FakeEndTagToken(){Name = "caption"});
         tree.ReprocessFlag = true;
         return;
     case "body":
     case "col":
     case "colgroup":
     case "html":
     case "tbody":
     case "td":
     case "tfoot":
     case "th":
     case "thead":
     case "tr":
         OnMessageRaised(new UnexpectedEndTagError(token.Name));
         return;
     }
     AppendAnythingElse(tree, token);
 }
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "tbody":
     case "tfoot":
     case "thead":
         if(!tree.StackOfOpenElements.HaveElementInTableScope(token.Name)){
             OnMessageRaised(new LonlyEndTagError(token.Name));
             return;
         }
         tree.StackOfOpenElements.ClearBackToTableBody();
         tree.PopFromStack();
         tree.ChangeInsertionMode<InTableInsertionMode>();
         return;
     case "table":
         tree.StackOfOpenElements.ClearBackToTableBody();
         AppendEndTagToken(tree, new FakeEndTagToken(){Name = tree.CurrentNode.Name});
         tree.ReprocessFlag = true;
         return;
     case "body":
     case "caption":
     case "col":
     case "colgroup":
     case "html":
     case "td":
     case "th":
     case "tr":
         OnMessageRaised(new LonlyEndTagError(token.Name));
         return;
     }
     AppendAnythingElse(tree, token);
 }
Exemple #5
0
        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)
 {
     switch(token.Name){
     case "html":
         tree.ChangeInsertionMode<AfterAfterBodyInsertionMode>();
         return;
     }
 }
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "html":
         tree.ChangeInsertionMode<AfterAfterFramesetInsertionMode>();
         return;
     }
     AppendAnythingElse(tree, token);
 }
 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)
 {
     switch(token.Name){
     case "frameset":
         tree.PopFromStack();
         if(!tree.StackOfOpenElements.IsCurrentNameMatch("frameset")){
             tree.ChangeInsertionMode<AfterFramesetInsertionMode>();
         }
         return;
     }
     AppendAnythingElse(tree, token);
 }
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "colgroup":
         tree.PopFromStack();
         tree.ChangeInsertionMode<InTableInsertionMode>();
         return;
     case "col":
         OnMessageRaised(new ColEndTagError());
         return;
     }
     AppendAnythingElse(tree, 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;
 }
Exemple #12
0
        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;
        }
Exemple #13
0
        public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
        {
            switch(token.Name){
            case "script":
                // Ignore?: Provide a stable state.
                // XmlElement script = tree.CurrentNode as XmlElement;
                tree.PopFromStack();
                tree.SwitchToOriginalInsertionMode();
                // Ignore? script etc.
                return;
            }

            // Any Other End Tag
            tree.PopFromStack();
            tree.SwitchToOriginalInsertionMode();
            return;
        }
 public override void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     switch(token.Name){
     case "caption":
     case "table":
     case "tbody":
     case "tfoot":
     case "thead":
     case "tr":
     case "td":
     case "th":
         OnMessageRaised(new UnexpectedEndTagInSelectInTableError(token.Name));
         if(tree.StackOfOpenElements.HaveElementInTableScope(token.Name)){
             AppendEndTagToken(tree, new FakeEndTagToken(){Name = "select"});
             tree.ReprocessFlag = true;
             return;
         }
         return;
     }
     AppendAnythingElse(tree, token);
 }
Exemple #15
0
 public virtual void AppendEndTagToken(TreeConstruction tree, EndTagToken token)
 {
     AppendAnythingElse(tree, token);
 }
Exemple #16
0
        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);
        }