public new HtmlTextAreaElement WithAttribute(HtmlAttribute attribute) => (HtmlTextAreaElement)base.WithAttribute(attribute);
public new HtmlArticleElement WithAttribute(HtmlAttribute attribute) => (HtmlArticleElement)base.WithAttribute(attribute);
public new HtmlAddressElement WithAttribute(HtmlAttribute attribute) => (HtmlAddressElement)base.WithAttribute(attribute);
public new HtmlColgroupElement WithAttribute(HtmlAttribute attribute) => (HtmlColgroupElement)base.WithAttribute(attribute);
public new HtmlOutputElement WithAttribute(HtmlAttribute attribute) => (HtmlOutputElement)base.WithAttribute(attribute);
protected internal HtmlAttribute(HtmlAttribute attribute) : this(attribute.Name, attribute.ProperName, attribute.Value, attribute.IsVoid, attribute.IsGlobal) { }
internal void RemoveAttribute(HtmlAttribute attribute) { _attributes.Remove(attribute); attribute.Parent = null; }
public new HtmlDatalistElement WithAttribute(HtmlAttribute attribute) => (HtmlDatalistElement)base.WithAttribute(attribute);
private void AddAttribute(HtmlAttribute attribute) { attribute.RemoveFromParent(); attribute.Parent = this; _attributes.AddAfter(_attributes._last, attribute); }
private void AddAttributeFirst(HtmlAttribute attribute) { attribute.RemoveFromParent(); attribute.Parent = this; _attributes.AddBefore(_attributes._first, attribute); }
public static T WithAttribute <T>(this T self, HtmlAttribute attribute) where T : HtmlElement { self.Add(attribute); return(self); }
public new HtmlDialogElement WithAttribute(HtmlAttribute attribute) => (HtmlDialogElement)base.WithAttribute(attribute);
public new HtmlScriptElement WithAttribute(HtmlAttribute attribute) => (HtmlScriptElement)base.WithAttribute(attribute);
public new HtmlCaptionElement WithAttribute(HtmlAttribute attribute) => (HtmlCaptionElement)base.WithAttribute(attribute);
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()); }
public new HtmlFormElement WithAttribute(HtmlAttribute attribute) => (HtmlFormElement)base.WithAttribute(attribute);
public new HtmlMenuItemElement WithAttribute(HtmlAttribute attribute) => (HtmlMenuItemElement)base.WithAttribute(attribute);