1- using System . Collections . Generic ;
1+ using System . Collections ;
2+ using System . Collections . Generic ;
23using System . IO ;
34
45namespace 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