AngleSharp by AngleSharp

<PackageReference Include="AngleSharp" Version="1.3.0" />

.NET API 960,512 bytes

 ElementExtensions

public static class ElementExtensions
Useful methods for element objects.
public static T AddClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Adds the specified class name(s) for all elements in the given collection.

public static T After<T>(this T elements, string html) where T : IEnumerable<IElement>

Inserts the nodes generated from the given HTML code after each element of the provided elements.

public static T Append<T>(this T elements, string html) where T : IEnumerable<IElement>

Appends the nodes generated from the given HTML code to each element of the provided elements.

public static T Attr<T>(this T elements, string attributeName, string attributeValue) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static T Attr<T>(this T elements, IEnumerable<KeyValuePair<string, string>> attributes) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static T Attr<T>(this T elements, object attributes) where T : IEnumerable<IElement>

Sets the specified attribute name to the specified value for all elements in the given collection.

public static IEnumerable<string> Attr<T>(this T elements, string attributeName) where T : IEnumerable<IElement>

Gets the values of the specified attribute for all elements in the given collection.

public static T Before<T>(this T elements, string html) where T : IEnumerable<IElement>

Inserts the nodes generated from the given HTML code before each element of the provided elements.

public static IElement ClearAttr(this IElement element)

Clears the attributes of the given element.

public static T ClearAttr<T>(this T elements) where T : IEnumerable<IElement>

Clears the attributes of all elements.

public static ResourceRequest CreateRequestFor(this IElement element, Url url)

Creates a new resource request from the provided element for the given url.

public static IElement Empty(this IElement element)

Empties the provided element.

public static T Empty<T>(this T elements) where T : IEnumerable<IElement>

Empties all provided elements.

public static string GetCssNamespace(this IElement el, string prefix)

Gets the CSS namespace that is defined via the provided prefix.

public static string GetNamespaceUri(this IElement element)

Gets the non-fixed namespace of the element.

public static string GetProperty(this IHtmlMetaElement element)

Returns the property attribute. Widely used for meta tags for Open Graph protocols

public static string GetSelector(this IElement element)

Creates a unique selector path used to locate the element in the DOM.

public static bool HasClass(this IEnumerable<IElement> elements, string className)

Checks if any element in the given collection has the given class(es).

public static string Html(this IElement element)

Gets the inner HTML of the given element.

public static T Html<T>(this T elements, string html) where T : IEnumerable<IElement>

Sets the inner HTML of the given elements.

public static bool IsActive(this IElement element)

Checks if the element is currently active.

public static bool IsChecked(this IElement element)

Checks if the element is currently checked.

public static bool IsDefault(this IElement element)

Checks if the element is an input element that is currently in its default state.

public static bool IsDisabled(this IElement element)

Checks if the element is currently disabled.

public static bool IsEditable(this IElement element)

Checks if the element is editable.

public static bool IsEnabled(this IElement element)

Checks if the element is currently enabled.

public static bool IsFirstChild(this IElement element)

Checks if the element is its parent's first child.

public static bool IsFirstOfType(this IElement element)

Checks if the element is the first of its type among the parent's children.

public static bool IsHovered(this IElement element)

Checks if the element is currently hovered. Not implemented, and will always return false.

public static bool IsIndeterminate(this IElement element)

Checks if the element is currently in its indeterminate state.

public static bool IsInRange(this IElement element)

Checks if the element's value is within the range.

public static bool IsInvalid(this IElement element)

Checks if the element does not validate.

public static bool IsLastChild(this IElement element)

Checks if the element is its parent's last child.

public static bool IsLastOfType(this IElement element)

Checks if the element is the last of its type among the parent's children.

public static bool IsLink(this IElement element)

Checks if the element is a link.

public static bool IsMutable(this IHtmlInputElement input)

Checks if the input can be changed.

public static bool IsMutable(this IHtmlTextAreaElement textArea)

Checks if the textarea can be changed.

public static bool IsOnlyChild(this IElement element)

Checks if the element is its parent's only child.

public static bool IsOnlyOfType(this IElement element)

Checks if the element is the only of its type among the parent's children.

public static bool IsOptional(this IElement element)

Checks if the element is only optional and not required.

public static bool IsOutOfRange(this IElement element)

Checks if the element's value is out-of-range.

public static bool IsPlaceholderShown(this IElement element)

Checks if the element is currently showing a placeholder.

public static bool IsPseudo(this IElement element, string name)

Checks if the element is a pseudo element (before or after).

public static bool IsReadOnly(this IElement element)

Checks if the element is readonly.

public static bool IsRequired(this IElement element)

Checks if the element is required and must be filled out.

public static bool IsShadow(this IElement element)

Checks if the element hosts a shadow tree.

public static bool IsTarget(this IElement element)

Checks if the element is currently targeted.

public static bool IsUnchecked(this IElement element)

Checks if the element is currently unchecked.

public static bool IsValid(this IElement element)

Checks if the element does validate.

public static bool IsVisible(this IElement element)

Checks if the element is visible on screen. Not implemented, and will always return false.

public static bool IsVisited(this IElement element)

Checks if the element has already been visited.

public static string LocateNamespaceFor(this IElement element, string prefix)

Locates the namespace of the given prefix.

public static string LocatePrefixFor(this IElement element, string namespaceUri)

Locates the prefix of the given namespace.

public static bool MatchesCssNamespace(this IElement el, string prefix)

Checks if the element with the provided prefix matches the CSS namespace.

public static Task<IDocument> NavigateAsync<TElement>(this TElement element) where TElement : IUrlUtilities, IElement

Navigates to the hyper reference given by the provided element without any possibility for cancellation.

public static Task<IDocument> NavigateAsync<TElement>(this TElement element, CancellationToken cancel) where TElement : IUrlUtilities, IElement

Navigates to the hyper reference given by the provided element.

public static T Prepend<T>(this T elements, string html) where T : IEnumerable<IElement>

Prepends the nodes generated from the given HTML code to each element of the provided elements.

public static T RemoveClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Removes the specified class name(s) for all elements in the given collection.

public static void SetProperty(this IHtmlMetaElement element, string value)

Sets the property value

public static IHtmlCollection<TElement> ToCollection<TElement>(this IEnumerable<TElement> elements) where TElement : IElement

Creates a new HTML Collection from the provided elements.

public static T ToggleClass<T>(this T elements, string className) where T : IEnumerable<IElement>

Toggles the specified class name(s) for all elements in the given collection.

public static bool TryLocateCustomNamespace(this IElement element, string prefix, out string namespaceUri)

Tries to locate a custom namespace URI.

public static bool TryLocateStandardNamespace(this IElement element, out string namespaceUri)

Tries to locate the standard namespace URI.

public static T Wrap<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps the given elements in the inner most element of the tree generated form the provided HTML code.

public static T WrapAll<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps all elements in the inner most element of the tree generated form the provided HTML code. The tree is appended before the first element of the given list.

public static T WrapInner<T>(this T elements, string html) where T : IEnumerable<IElement>

Wraps the content of the given elements in the inner most element of the tree generated form the provided HTML code.