@@ -5,6 +5,8 @@ import getParserInput from './parser-input';
55import * as utils from '../utils' ;
66import functionRegistry from '../functions/function-registry' ;
77import { ContainerSyntaxOptions , MediaSyntaxOptions } from '../tree/atrule-syntax' ;
8+ import Selector from '../tree/selector' ;
9+ import Anonymous from '../tree/anonymous' ;
810
911//
1012// less.js - parser
@@ -1312,9 +1314,25 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
13121314 if ( ! e ) {
13131315 parserInput . save ( ) ;
13141316 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+ }
13181336 } else {
13191337 parserInput . restore ( 'Missing closing \')\'' ) ;
13201338 }
@@ -1395,7 +1413,9 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
13951413 } else {
13961414 if ( allExtends ) { error ( 'Extend can only be used at the end of selector' ) ; }
13971415 c = parserInput . currentChar ( ) ;
1398- if ( elements ) {
1416+ if ( Array . isArray ( e ) ) {
1417+ e . forEach ( ele => elements . push ( ele ) ) ;
1418+ } if ( elements ) {
13991419 elements . push ( e ) ;
14001420 } else {
14011421 elements = [ e ] ;
0 commit comments