@@ -69,7 +69,10 @@ public class CssRuleSet extends CssStatement {
6969 private List <CssDeclaration > importantDeclarations ;
7070
7171 /**
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)}
7376 *
7477 * @param selector the CSS selector
7578 * @param declarations the CSS declarations
@@ -78,7 +81,13 @@ public CssRuleSet(ICssSelector selector, List<CssDeclaration> declarations) {
7881 this .selector = selector ;
7982 this .normalDeclarations = new ArrayList <>();
8083 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 ;
8291 }
8392
8493 /* (non-Javadoc)
@@ -151,7 +160,7 @@ public List<CssDeclaration> getImportantDeclarations() {
151160 *
152161 * @param declarations the declarations
153162 */
154- private void splitDeclarationsIntoNormalAndImportant (List <CssDeclaration > declarations ) {
163+ private static void splitDeclarationsIntoNormalAndImportant (List <CssDeclaration > declarations , List < CssDeclaration > normalDeclarations , List < CssDeclaration > importantDeclarations ) {
155164 for (CssDeclaration declaration : declarations ) {
156165 int exclIndex = declaration .getExpression ().indexOf ('!' );
157166 if (exclIndex > 0 && importantMatcher .matcher (declaration .getExpression ()).matches ()) {
0 commit comments