Skip to content

Commit

Permalink
Added extra API method for computing style
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Jan 19, 2024
1 parent d856b31 commit 8205cf8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/AngleSharp.Css/Extensions/CssOmExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace AngleSharp.Css.Dom
{
using AngleSharp.Css.Parser;
using AngleSharp.Css.Values;
using AngleSharp.Dom;
using AngleSharp.Text;
using System;
using System.Linq;
Expand All @@ -11,6 +12,18 @@ namespace AngleSharp.Css.Dom
/// </summary>
public static class CssOmExtensions
{
/// <summary>
/// Gets the computed style of the element.
/// </summary>
/// <param name="element">The element to compute the style for.</param>
/// <param name="pseudo">The optional pseudo selector to use.</param>
/// <returns>The computed style of the element.</returns>
public static ICssStyleDeclaration ComputeStyle(this IElement element, String pseudo = null)
{
var window = element?.Owner?.DefaultView;
return window?.GetComputedStyle(element, pseudo);
}

/// <summary>
/// Gets the style rule with the provided selector text.
/// </summary>
Expand Down

0 comments on commit 8205cf8

Please sign in to comment.