API Reference
HtmlElement
An owned element with ordered, namespace-aware attributes.
Inheritance
- HtmlNode
- HtmlElement
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method HtmlDocument.CreateElement
- Method HtmlDocument.QuerySelector
- Method HtmlDocument.QuerySelectorAll
- Property HtmlDocument.Body
- Property HtmlDocument.Children
- Property HtmlDocument.DocumentElement
- Property HtmlDocument.Head
- Property HtmlDocument.ParentElement
- Method HtmlDocumentType.QuerySelector
- Method HtmlDocumentType.QuerySelectorAll
- Property HtmlDocumentType.Children
- Property HtmlDocumentType.ParentElement
- Method HtmlElement.Closest
- Method HtmlElement.QuerySelector
- Method HtmlElement.QuerySelectorAll
- Property HtmlElement.Children
- Property HtmlElement.ParentElement
- Method HtmlNode.QuerySelector
- Method HtmlNode.QuerySelectorAll
- Property HtmlNode.Children
- Property HtmlNode.ParentElement
- Method IHtmlDomServices.QuerySelectorAll
Accepted by parameters
Methods
public HtmlElement Closest(String selector) #HtmlElementFinds this element or its nearest ancestor matching a selector.
Parameters
- selector System.String
public String GetAttribute(String name) #StringReads the first attribute with this qualified name, regardless of namespace.
Parameters
- name System.String
public String GetAttribute(String namespaceUri, String localName) #StringReads an attribute by namespace URI and local name.
Parameters
- namespaceUri System.String
- localName System.String
public Boolean HasAttribute(String name) #BooleanChecks whether a qualified attribute is present.
Parameters
- name System.String
public Boolean Matches(String selector) #BooleanTests this element against a CSS selector.
Parameters
- selector System.String
public Void RemoveAttribute(String name) #VoidRemoves the first attribute with this qualified name, regardless of namespace.
Parameters
- name System.String
public Void RemoveAttribute(String namespaceUri, String localName) #VoidRemoves an attribute by namespace URI and local name.
Parameters
- namespaceUri System.String
- localName System.String
public Void SetAttribute(String name, String value, String namespaceUri = null) #VoidAdds or replaces an attribute in the supplied namespace; omitting the namespace selects the empty namespace.
Parameters
- name System.String
- value System.String
- namespaceUri System.String = null
Inherited Methods
public HtmlNode AppendChild(HtmlNode child) #HtmlNodeParameters
- child HtmlNode
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
public HtmlElement QuerySelector(String selector) #HtmlElementParameters
- selector String
public IReadOnlyList<HtmlElement> QuerySelectorAll(String selector) #IReadOnlyList<HtmlElement>Parameters
- selector String
Properties
public String LocalName { get; } #Element local name, preserving foreign-content case.
public String NamespaceUri { get; } #Element namespace URI.
public String Prefix { get; } #Namespace prefix, or an empty string.
public override String NodeName { get; } #public IReadOnlyList<HtmlAttribute> Attributes { get; } #Ordered attributes.
public String Id { get; } #Value of the empty-namespace id attribute, or an empty string.
public String ClassName { get; } #Value of the empty-namespace class attribute, or an empty string.
public IReadOnlyList<String> ClassList { get; } #Class tokens for inspection.
public HtmlNode TemplateContent { get; set; } #Template contents, retained separately from normal child nodes.