Пример #1
0
        private static bool IsSelfClosing(Block beginTagBlock)
        {
            var childSpan = beginTagBlock.FindLastDescendentSpan();

            return childSpan?.Content.EndsWith("/>") ?? false;
        }
Пример #2
0
        private static TagMode GetTagMode(
            string tagName,
            Block beginTagBlock,
            IEnumerable<TagHelperDescriptor> descriptors,
            ErrorSink errorSink)
        {
            var childSpan = beginTagBlock.FindLastDescendentSpan();

            // Self-closing tags are always valid despite descriptors[X].TagStructure.
            if (childSpan?.Content.EndsWith("/>") ?? false)
            {
                return TagMode.SelfClosing;
            }

            var baseDescriptor = descriptors.FirstOrDefault(
                descriptor => descriptor.TagStructure != TagStructure.Unspecified);
            var resolvedTagStructure = baseDescriptor?.TagStructure ?? TagStructure.Unspecified;
            if (resolvedTagStructure == TagStructure.WithoutEndTag)
            {
                return TagMode.StartTagOnly;
            }

            return TagMode.StartTagAndEndTag;
        }
        private static bool IsSelfClosing(Block childBlock)
        {
            var childSpan = childBlock.FindLastDescendentSpan();

            return childSpan?.Content.EndsWith("/>", StringComparison.Ordinal) ?? false;
        }