@@ -69,7 +69,10 @@ public class CssRuleSet extends CssStatement {
69
69
private List <CssDeclaration > importantDeclarations ;
70
70
71
71
/**
72
- * Creates a new {@link CssRuleSet}.
72
+ * Creates a new {@link CssRuleSet} from selector and raw list of declarations.
73
+ * The declarations are split into normal and important under the hood.
74
+ * To construct the {@link CssRuleSet} instance from normal and important declarations, see
75
+ * {@link #CssRuleSet(ICssSelector, List, List)}
73
76
*
74
77
* @param selector the CSS selector
75
78
* @param declarations the CSS declarations
@@ -78,7 +81,13 @@ public CssRuleSet(ICssSelector selector, List<CssDeclaration> declarations) {
78
81
this .selector = selector ;
79
82
this .normalDeclarations = new ArrayList <>();
80
83
this .importantDeclarations = new ArrayList <>();
81
- splitDeclarationsIntoNormalAndImportant (declarations );
84
+ splitDeclarationsIntoNormalAndImportant (declarations , normalDeclarations , importantDeclarations );
85
+ }
86
+
87
+ public CssRuleSet (ICssSelector selector , List <CssDeclaration > normalDeclarations , List <CssDeclaration > importantDeclarations ) {
88
+ this .selector = selector ;
89
+ this .normalDeclarations = normalDeclarations ;
90
+ this .importantDeclarations = importantDeclarations ;
82
91
}
83
92
84
93
/* (non-Javadoc)
@@ -151,7 +160,7 @@ public List<CssDeclaration> getImportantDeclarations() {
151
160
*
152
161
* @param declarations the declarations
153
162
*/
154
- private void splitDeclarationsIntoNormalAndImportant (List <CssDeclaration > declarations ) {
163
+ private static void splitDeclarationsIntoNormalAndImportant (List <CssDeclaration > declarations , List < CssDeclaration > normalDeclarations , List < CssDeclaration > importantDeclarations ) {
155
164
for (CssDeclaration declaration : declarations ) {
156
165
int exclIndex = declaration .getExpression ().indexOf ('!' );
157
166
if (exclIndex > 0 && importantMatcher .matcher (declaration .getExpression ()).matches ()) {
0 commit comments