Microsoft.Html.Core.Tree.Builder.DefaultHtmlClosureProvider.IsImplicitlyClosed C# (CSharp) Method

IsImplicitlyClosed() public method

Determines if given element can be implicitly closed like <li> or <td> in HTML"
public IsImplicitlyClosed ( ITextProvider text, ITextRange name, string &containerElementNames ) : bool
text ITextProvider Text provider
name ITextRange Element name
containerElementNames string
return bool
        public bool IsImplicitlyClosed(ITextProvider text, ITextRange name, out string[] containerElementNames) {
            containerElementNames = null;

            if (name.Length < _minCharCountImplicitClosing || name.Length > _maxCharCountImplicitClosing)
                return false;

            bool found = FindElementName(text, name, _implicitlyClosingElementNameIndex, ignoreCase: true);
            if (found) {
                string elementName = text.GetText(name);
                containerElementNames = GetContainerElements(elementName);
            }
            return found;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Detemines of element can be implicitly closed (i.e. element does not require closing tag) like &lt;td&gt;
        /// Only applies to regular HTML elements. Does not apply to elements with prefixes or namespaces.
        /// </summary>
        /// <param name="textProvider">Text provider</param>
        /// <param name="nameRange">Range of the element name</param>
        /// <returns>True if element can be implicitly closed</returns>
        public bool IsImplicitlyClosed(ITextProvider textProvider, ITextRange nameRange, out string[] containerNames)
        {
            Debug.Assert(nameRange.Length > 0);

            // Only HTML elements can be implicitly closed
            return(_defaultProvider.IsImplicitlyClosed(textProvider, nameRange, out containerNames));
        }
All Usage Examples Of Microsoft.Html.Core.Tree.Builder.DefaultHtmlClosureProvider::IsImplicitlyClosed