Пример #1
0
 public new HtmlTextAreaElement WithAttribute(HtmlAttribute attribute) => (HtmlTextAreaElement)base.WithAttribute(attribute);
Пример #2
0
 public new HtmlArticleElement WithAttribute(HtmlAttribute attribute) => (HtmlArticleElement)base.WithAttribute(attribute);
Пример #3
0
 public new HtmlAddressElement WithAttribute(HtmlAttribute attribute) => (HtmlAddressElement)base.WithAttribute(attribute);
Пример #4
0
 public new HtmlColgroupElement WithAttribute(HtmlAttribute attribute) => (HtmlColgroupElement)base.WithAttribute(attribute);
Пример #5
0
 public new HtmlOutputElement WithAttribute(HtmlAttribute attribute) => (HtmlOutputElement)base.WithAttribute(attribute);
Пример #6
0
 protected internal HtmlAttribute(HtmlAttribute attribute) : this(attribute.Name, attribute.ProperName, attribute.Value, attribute.IsVoid, attribute.IsGlobal)
 {
 }
Пример #7
0
 internal void RemoveAttribute(HtmlAttribute attribute)
 {
     _attributes.Remove(attribute);
     attribute.Parent = null;
 }
Пример #8
0
 public new HtmlDatalistElement WithAttribute(HtmlAttribute attribute) => (HtmlDatalistElement)base.WithAttribute(attribute);
Пример #9
0
 private void AddAttribute(HtmlAttribute attribute)
 {
     attribute.RemoveFromParent();
     attribute.Parent = this;
     _attributes.AddAfter(_attributes._last, attribute);
 }
Пример #10
0
 private void AddAttributeFirst(HtmlAttribute attribute)
 {
     attribute.RemoveFromParent();
     attribute.Parent = this;
     _attributes.AddBefore(_attributes._first, attribute);
 }
Пример #11
0
 public static T WithAttribute <T>(this T self, HtmlAttribute attribute) where T : HtmlElement
 {
     self.Add(attribute);
     return(self);
 }
Пример #12
0
 public new HtmlDialogElement WithAttribute(HtmlAttribute attribute) => (HtmlDialogElement)base.WithAttribute(attribute);
Пример #13
0
 public new HtmlScriptElement WithAttribute(HtmlAttribute attribute) => (HtmlScriptElement)base.WithAttribute(attribute);
Пример #14
0
 public new HtmlCaptionElement WithAttribute(HtmlAttribute attribute) => (HtmlCaptionElement)base.WithAttribute(attribute);
Пример #15
0
            private bool TryParseAttribute(out HtmlAttribute attribute)
            {
                attribute = null;
                string name;
                bool   isExtendedAttribute;
                bool   isFinalAttribute;

                if (!TryParseAttributeName(out name, out isExtendedAttribute, out isFinalAttribute))
                {
                    // Invalid attribute, e.g. "<abc attribute"
                    return(false);
                }
                if (isFinalAttribute || !isExtendedAttribute)
                {
                    attribute = new HtmlAttribute(name);
                    return(true);
                }
                bool singleDelimeted = currentChar == '\'';
                bool doubleDelimeted = currentChar == '"';
                bool notDelimited    = IsLetter(currentChar);

                if (!singleDelimeted && !doubleDelimeted && !notDelimited)
                {
                    // Invalid character after equals, e.g. "<abc attribute=" or "<abc attribute=!"
                    parseError = HtmlParseError.NoAttributeValue;
                    return(false);
                }
                int valueStartIndex = notDelimited ? currentIndex : currentIndex + 1;
                int valueEndIndex   = -1;

                while (ReadNext())
                {
                    if (singleDelimeted)
                    {
                        if (currentChar == '\'')
                        {
                            valueEndIndex = currentIndex - 1;
                            break;
                        }
                        continue;
                    }
                    else if (doubleDelimeted)
                    {
                        if (currentChar == '"')
                        {
                            valueEndIndex = currentIndex - 1;
                            break;
                        }
                        continue;
                    }
                    else
                    {
                        bool foundWhitespace = char.IsWhiteSpace(currentChar);
                        if (char.IsWhiteSpace(currentChar))
                        {
                            valueEndIndex = currentIndex - 1;
                            ReadAndSkipWhitespace();
                        }
                        if (currentChar == '/' || currentChar == '>')
                        {
                            if (valueEndIndex == -1)
                            {
                                valueEndIndex = currentIndex - 1;
                            }
                            break;
                        }
                        else if (foundWhitespace)
                        {
                            // Found another attribute
                            break;
                        }
                        continue;
                    }
                }
                if (valueEndIndex == -1)
                {
                    // No end of attribute value, e.g. "<abc attribute=", "<abc attribute=', "<abc attribute="a, "<abc attribute='a or , "<abc attribute=a
                    parseError = HtmlParseError.OpeningTagNotClosedAfterAttribute;
                    return(false);
                }
                string value = text.Substring(valueStartIndex, valueEndIndex - valueStartIndex + 1);

                attribute = new HtmlAttribute(name, value);
                return(notDelimited || ReadAndSkipWhitespace());
            }
Пример #16
0
 public new HtmlFormElement WithAttribute(HtmlAttribute attribute) => (HtmlFormElement)base.WithAttribute(attribute);
Пример #17
0
 public new HtmlMenuItemElement WithAttribute(HtmlAttribute attribute) => (HtmlMenuItemElement)base.WithAttribute(attribute);