Skip to content

Commit 41dc288

Browse files
authored
Merge pull request #160 from inforithmics/MakeCombinatorSelectorVisible
Make CombinatorSelector Public
2 parents c85b2cb + a36f751 commit 41dc288

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

src/ExCSS/Enumerations/Combinators.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
namespace ExCSS
22
{
3-
internal static class Combinators
3+
public static class Combinators
44
{
55
public static readonly string Exactly = "=";
66
public static readonly string Unlike = "!=";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace ExCSS
2+
{
3+
public struct CombinatorSelector
4+
{
5+
public string Delimiter { get; internal set; }
6+
public ISelector Selector { get; internal set; }
7+
}
8+
}

src/ExCSS/Selectors/ComplexSelector.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
using System.Collections.Generic;
1+
using System.Collections;
2+
using System.Collections.Generic;
23
using System.IO;
34

45
namespace ExCSS
56
{
6-
public sealed class ComplexSelector : StylesheetNode, ISelector
7+
public sealed class ComplexSelector : StylesheetNode, ISelector, IEnumerable<CombinatorSelector>
78
{
89
private readonly List<CombinatorSelector> _selectors;
910

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

15-
private struct CombinatorSelector
16-
{
17-
public string Delimiter;
18-
public ISelector Selector;
19-
}
20-
2116
public string Text => this.ToCss();
2217
public int Length => _selectors.Count;
2318
public bool IsReady { get; private set; }
@@ -68,8 +63,18 @@ public void AppendSelector(ISelector selector, Combinator combinator)
6863
_selectors.Add(new CombinatorSelector
6964
{
7065
Selector = combinator.Change(selector),
71-
Delimiter = combinator.Delimiter
66+
Delimiter = combinator.Delimiter,
7267
});
7368
}
69+
70+
public IEnumerator<CombinatorSelector> GetEnumerator()
71+
{
72+
return _selectors.GetEnumerator();
73+
}
74+
75+
IEnumerator IEnumerable.GetEnumerator()
76+
{
77+
return GetEnumerator();
78+
}
7479
}
7580
}

0 commit comments

Comments
 (0)