コード例 #1
0
ファイル: HtmlTagState.cs プロジェクト: dgjbss/MonoDevelopWin
        //TODO: implement real implicit closing logic from HTML5 spec
        // see http://www.w3.org/html/wg/drafts/html/master/syntax.html#syntax-tag-omission
        public static bool IsImplicitlyClosedBy(this XElement parent, INamedXObject current)
        {
            //inline and paragraph tags are implicitly closed by block tags and paragraph tags
            switch (parent.Name.Name)
            {
            case "p":
                return(ElementTypes.IsParaOptionalClosing(current.Name.Name));

            case "td":
                return(current.Name.Name == "td" || current.Name.Name == "th");

            case "th":
                return(current.Name.Name == "td" || current.Name.Name == "th");

            case "dt":
                return(current.Name.Name == "dt" || current.Name.Name == "dd");

            case "dd":
                return(current.Name.Name == "dt" || current.Name.Name == "dd");

            case "thead":
                return(current.Name.Name == "tbody" || current.Name.Name == "tfoot");

            case "tbody":
                return(current.Name.Name == "tbody" || current.Name.Name == "tfoot");

            case "option":
                return(current.Name.Name == "option" || current.Name.Name == "optgroup");

            case "tr":
                return(current.Name.Name == "tr");

            case "li":
                return(current.Name.Name == "li");

            case "tfoot":
                return(current.Name.Name == "tbody");

            case "optgroup":
                return(current.Name.Name == "optgroup");

            default:
                return(false);
            }
        }