@@ -5,6 +5,8 @@ import getParserInput from './parser-input';
5
5
import * as utils from '../utils' ;
6
6
import functionRegistry from '../functions/function-registry' ;
7
7
import { ContainerSyntaxOptions , MediaSyntaxOptions } from '../tree/atrule-syntax' ;
8
+ import Selector from '../tree/selector' ;
9
+ import Anonymous from '../tree/anonymous' ;
8
10
9
11
//
10
12
// less.js - parser
@@ -1312,9 +1314,25 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
1312
1314
if ( ! e ) {
1313
1315
parserInput . save ( ) ;
1314
1316
if ( parserInput . $char ( '(' ) ) {
1315
- if ( ( v = this . selector ( false ) ) && parserInput . $char ( ')' ) ) {
1316
- e = new ( tree . Paren ) ( v ) ;
1317
- parserInput . forget ( ) ;
1317
+ if ( ( v = this . selector ( false ) ) ) {
1318
+ let selectors = [ ] ;
1319
+ while ( parserInput . $char ( ',' ) ) {
1320
+ selectors . push ( v ) ;
1321
+ selectors . push ( new Anonymous ( ',' ) ) ;
1322
+ v = this . selector ( false ) ;
1323
+ }
1324
+ selectors . push ( v ) ;
1325
+
1326
+ if ( parserInput . $char ( ')' ) ) {
1327
+ if ( selectors . length > 1 ) {
1328
+ e = new ( tree . Paren ) ( new Selector ( selectors ) ) ;
1329
+ } else {
1330
+ e = new ( tree . Paren ) ( v ) ;
1331
+ }
1332
+ parserInput . forget ( ) ;
1333
+ } else {
1334
+ parserInput . restore ( 'Missing closing \')\'' ) ;
1335
+ }
1318
1336
} else {
1319
1337
parserInput . restore ( 'Missing closing \')\'' ) ;
1320
1338
}
@@ -1395,7 +1413,9 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
1395
1413
} else {
1396
1414
if ( allExtends ) { error ( 'Extend can only be used at the end of selector' ) ; }
1397
1415
c = parserInput . currentChar ( ) ;
1398
- if ( elements ) {
1416
+ if ( Array . isArray ( e ) ) {
1417
+ e . forEach ( ele => elements . push ( ele ) ) ;
1418
+ } if ( elements ) {
1399
1419
elements . push ( e ) ;
1400
1420
} else {
1401
1421
elements = [ e ] ;
0 commit comments