Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

HtmlElement

OfficeIMO.Html.Dom

Namespace
OfficeIMO.Html.Dom
Assembly
OfficeIMO.Html.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
sealed

An owned element with ordered, namespace-aware attributes.

Inheritance

Usage

Explore 31 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 5

Methods

public HtmlElement? Closest(string selector) #

Finds this element or its nearest ancestor matching a selector.

Parameters

selector string required

Returns

HtmlElement?
GetAttribute 2 overloads
public string? GetAttribute(string name) #

Reads the first attribute with this qualified name, regardless of namespace.

Parameters

name string required

Returns

string?
public string? GetAttribute(string namespaceUri, string localName) #

Reads an attribute by namespace URI and local name.

Parameters

namespaceUri string required
localName string required

Returns

string?
public bool HasAttribute(string name) #

Checks whether a qualified attribute is present.

Parameters

name string required

Returns

bool
public bool Matches(string selector) #

Tests this element against a CSS selector.

Parameters

selector string required

Returns

bool
RemoveAttribute 2 overloads
public void RemoveAttribute(string name) #

Removes the first attribute with this qualified name, regardless of namespace.

Parameters

name string required
public void RemoveAttribute(string namespaceUri, string localName) #

Removes an attribute by namespace URI and local name.

Parameters

namespaceUri string required
localName string required
SetAttribute 2 overloads
public void SetAttribute(string name, string value, string? namespaceUri = null) #

Adds or replaces an attribute in the supplied namespace; omitting the namespace selects the empty namespace.

Parameters

name string required
value string required
namespaceUri string? = null optional
public void SetAttribute(HtmlAttribute replacement) #

Adds or replaces an exact attribute by namespace and local name, preserving its qualified name and case.

Parameters

replacement OfficeIMO.Html.Dom.HtmlAttribute required

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; } #

Node name for non-element nodes; elements expose their local name.

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 HtmlDocumentFragment? TemplateContent { get; internal set; } #

Template contents, retained separately from normal child nodes.

public HtmlFormControlState? FormState { get; set; } #

Optional immutable live form properties. Attributes and text retain their authored defaults.

Fields

public const string HtmlNamespace #

HTML namespace URI.

Value: http://www.w3.org/1999/xhtml