当前位置: 首页>>代码示例>>C#>>正文


C# HtmlTag.TagName方法代码示例

本文整理汇总了C#中HtmlTags.HtmlTag.TagName方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTag.TagName方法的具体用法?C# HtmlTag.TagName怎么用?C# HtmlTag.TagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlTags.HtmlTag的用法示例。


在下文中一共展示了HtmlTag.TagName方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Visit

 public void Visit(HtmlTag table)
 {
     if (table.TagName().ToLower() != HtmlTagConstants.Table)
     {
         throw new ArgumentException(string.Format("Expected tag to be a <{0}> tag, but was <{1}>", HtmlTagConstants.Table,
                                                   table.TagName()));
     }
     table.Children.ForEach(VisitTableChild);
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:9,代码来源:HtmlTagToExportVisitor.cs

示例2: VisitImage

 public ExportImage VisitImage(HtmlTag imageTag)
 {
     if (imageTag.TagName().ToLower() != HtmlTagConstants.Img)
     {
         throw new ArgumentException(string.Format("Expected tag to be a <{0}> tag, but was <{1}>", HtmlTagConstants.Img,
                                                   imageTag.TagName()));
     }
     var image = (ImageTag) imageTag;
     return new ExportImage {Source = image.Src(), AlternateText = image.Alt()};
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:10,代码来源:HtmlTagToExportVisitor.cs

示例3: VisitList

 public ExportList VisitList(HtmlTag list )
 {
     if(list.TagName().ToLower() != HtmlTagConstants.Ul )
     {
         throw new ArgumentException(string.Format("Expected tag to be a <{0}> tag, but was <{1}>", HtmlTagConstants.Ul,
                                               list.TagName()));
     }
     var exportList = new ExportList();
     list.Children.ForEach(f => VisitListItem(f, exportList));
     return exportList;
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:11,代码来源:HtmlTagToExportVisitor.cs

示例4: AssertOptionGroup

 private void AssertOptionGroup(
     HtmlTag optgroup,
     string display)
 {
     Assert.Equal("optgroup", optgroup.TagName());
     Assert.Equal(display, optgroup.Attr("label"));
 }
开发者ID:matutee,项目名称:Bardock.Utils,代码行数:7,代码来源:GroupedSelectTagTest.cs

示例5: do_nothing_to_a_link_that_is_authorized

        public void do_nothing_to_a_link_that_is_authorized()
        {
            var tag = new HtmlTag("a").Authorized(true)
                .ReadOnlyIfNotAuthorized();

            tag.Authorized().ShouldBeTrue();
            tag.TagName().ShouldEqual("a");
        }
开发者ID:nieve,项目名称:fubumvc,代码行数:8,代码来源:AuthorizationOnPageExtensionsTester.cs

示例6: do_nothing_to_a_div

        public void do_nothing_to_a_div()
        {
            var tag = new HtmlTag("div").Authorized(false)
                .ReadOnlyIfNotAuthorized();

            tag.Authorized().ShouldBeFalse();
            tag.TagName().ShouldEqual("div");
        }
开发者ID:nieve,项目名称:fubumvc,代码行数:8,代码来源:AuthorizationOnPageExtensionsTester.cs

示例7: change_an_unauthorized_link_to_a_span_and_authorize_the_span

        public void change_an_unauthorized_link_to_a_span_and_authorize_the_span()
        {
            var tag = new HtmlTag("a").Authorized(false)
                .ReadOnlyIfNotAuthorized();

            tag.Authorized().ShouldBeTrue();
            tag.TagName().ShouldEqual("span");
        }
开发者ID:nieve,项目名称:fubumvc,代码行数:8,代码来源:AuthorizationOnPageExtensionsTester.cs

示例8: AssertOption

 private void AssertOption(
     HtmlTag option,
     string display, 
     object value)
 {
     Assert.Equal("option", option.TagName());
     Assert.Equal(display, option.Text());
     Assert.True(option.ValueIsEqual(value));
 }
开发者ID:matutee,项目名称:Bardock.Utils,代码行数:9,代码来源:GroupedSelectTagTest.cs

示例9: VisitListItem

        public void VisitListItem(HtmlTag list, ExportListItem exportList)
        {
            var item = new ExportListItem();
            if(list.TagName().ToLower() == HtmlTagConstants.Ul)
            {
                item = new ExportList();
            }

            list.Children.ForEach(f => VisitListItem(f, item));
            item.Text = ExportFromTable.HtmlTagRegex.Replace(list.Text(), String.Empty);

            exportList.AddItem(item);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:13,代码来源:HtmlTagToExportVisitor.cs

示例10: AssertValid

        public void AssertValid(HtmlTag tag, string tagName, string name, string type = "", object value = null)
        {
            Assert.Equal(tagName, tag.TagName());
            Assert.Equal(name, tag.Attr("name"));
            Assert.Equal(name, tag.Attr("id"));

            if (type == null)
                Assert.False(tag.HasAttr("type"));
            else
                Assert.Equal(type, tag.Attr("type"));

            if (value == null)
                Assert.True(!tag.HasAttr("value") || tag.Attr("value") == "");
            else
                Assert.Equal(value.ToString(), tag.Attr("value"));
        }
开发者ID:matutee,项目名称:Bardock.Utils,代码行数:16,代码来源:HtmlTagHelperTest.cs

示例11: ChildTagBuilder

            public ChildTagBuilder(SpecHierarchyBuilder builder, HtmlTag parent)
            {
                if (parent.TagName() != "ul")
                {
                    throw new ArgumentOutOfRangeException("Only ul tags are valid here:  \n" + parent.ToString());
                }

                _builder = builder;
                _parent = parent;
            }
开发者ID:DRHouk,项目名称:fubumvc,代码行数:10,代码来源:SpecHierarchyBuilder.cs

示例12: TopTag

        public HtmlTag TopTag(HtmlTag topChild)
        {
            if (topChild.TagName() != "ul")
            {
                throw new ArgumentOutOfRangeException("Only ul tags are valid here:  \n" + topChild.ToString());
            }

            var topUrl = _urls.UrlFor<JasminePages>(x => x.AllSpecs());
            return new HtmlTag("ul", tag =>
            {
                tag.Id("all-specs-node").AddClass("filetree");

                var link = new LinkTag("All Specs", topUrl, "all-specs");
                var li = tag.Add("li");
                li.Add("span").AddClass("folder").Append(link);

                li.Append(topChild);
            });
        }
开发者ID:DRHouk,项目名称:fubumvc,代码行数:19,代码来源:SpecHierarchyBuilder.cs

示例13: VisitTableChild

 private void VisitTableChild(HtmlTag child)
 {
     var tag = child.TagName().ToLower();
     switch (tag)
     {
         case HtmlTagConstants.Tr:
             VisitTableRow(child);
             break;
         case HtmlTagConstants.Caption:
             VisitCaption(child);
             break;
         default:
             child.Children.ForEach(VisitTableChild);
             break;
     }
 }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:16,代码来源:HtmlTagToExportVisitor.cs

示例14: VisitTableCell

        private static void VisitTableCell(HtmlTag cell, ExportRow exportRow)
        {
            var tag = cell.TagName().ToLower();
            if (tag != HtmlTagConstants.Td && tag != HtmlTagConstants.Th )
            {
                cell.Children.ForEach(c => VisitTableCell(c, exportRow));
                return;
            }
            var isImage = cell.Children.Any(c => c.TagName().ToLower() == HtmlTagConstants.Img);
            var text = cell.Children.Any() ? cell.ToString() : cell.Text();
            var exportCell = new ExportCell
                             	{
                                    Text =  ExportFromTable.HtmlTagRegex.Replace(text ?? string.Empty, string.Empty),
                                    Markup = isImage ? cell.FirstChild().ToString():string.Empty
                                };

            SetColspan(cell, exportCell);
            exportRow.AddCell(exportCell);
        }
开发者ID:phoenixwebgroup,项目名称:DotNetExtensions,代码行数:19,代码来源:HtmlTagToExportVisitor.cs


注:本文中的HtmlTags.HtmlTag.TagName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。