Skip to content

Commit

Permalink
Merge pull request #160 from inforithmics/MakeCombinatorSelectorVisible
Browse files Browse the repository at this point in the history
Make CombinatorSelector Public
  • Loading branch information
TylerBrinks authored Aug 28, 2023
2 parents c85b2cb + a36f751 commit 41dc288
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ExCSS/Enumerations/Combinators.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace ExCSS
{
internal static class Combinators
public static class Combinators
{
public static readonly string Exactly = "=";
public static readonly string Unlike = "!=";
Expand Down
8 changes: 8 additions & 0 deletions src/ExCSS/Selectors/CombinatorSelector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ExCSS
{
public struct CombinatorSelector
{
public string Delimiter { get; internal set; }
public ISelector Selector { get; internal set; }
}
}
23 changes: 14 additions & 9 deletions src/ExCSS/Selectors/ComplexSelector.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.Generic;
using System.Collections;
using System.Collections.Generic;
using System.IO;

namespace ExCSS
{
public sealed class ComplexSelector : StylesheetNode, ISelector
public sealed class ComplexSelector : StylesheetNode, ISelector, IEnumerable<CombinatorSelector>
{
private readonly List<CombinatorSelector> _selectors;

Expand All @@ -12,12 +13,6 @@ public ComplexSelector()
_selectors = new List<CombinatorSelector>();
}

private struct CombinatorSelector
{
public string Delimiter;
public ISelector Selector;
}

public string Text => this.ToCss();
public int Length => _selectors.Count;
public bool IsReady { get; private set; }
Expand Down Expand Up @@ -68,8 +63,18 @@ public void AppendSelector(ISelector selector, Combinator combinator)
_selectors.Add(new CombinatorSelector
{
Selector = combinator.Change(selector),
Delimiter = combinator.Delimiter
Delimiter = combinator.Delimiter,
});
}

public IEnumerator<CombinatorSelector> GetEnumerator()
{
return _selectors.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

0 comments on commit 41dc288

Please sign in to comment.