File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,38 @@ public function getAllDeclarationBlocks() {
206
206
public function getAllSelectors () {
207
207
return $ this ->getAllDeclarationBlocks ();
208
208
}
209
-
209
+
210
+ /**
211
+ * Return a list of single class selectors
212
+ *
213
+ * @return array
214
+ */
215
+ public function getSingleClassSelectorList () {
216
+ $ results = array ();
217
+ $ blocks = $ this ->getAllDeclarationBlocks ();
218
+ foreach ($ blocks as $ block )
219
+ {
220
+ $ selectors = $ block ->getSelectors ();
221
+
222
+ foreach ($ selectors as $ sel )
223
+ {
224
+ $ selctorParts = explode (" " , $ sel );
225
+ if (count ($ selctorParts ) > 1 )
226
+ {
227
+ continue ;
228
+ }
229
+
230
+ //Only accept class selectors
231
+ if (preg_match ('/^\./ ' , $ sel ))
232
+ {
233
+ $ results [] = (string )$ sel ;
234
+ }
235
+ }
236
+ }
237
+ return $ results ;
238
+ }
239
+
240
+
210
241
/**
211
242
* Returns all CSSRuleSet objects found recursively in the tree.
212
243
*/
You can’t perform that action at this time.
0 commit comments