File tree Expand file tree Collapse file tree 2 files changed +16
-26
lines changed
Expand file tree Collapse file tree 2 files changed +16
-26
lines changed Original file line number Diff line number Diff line change @@ -485,19 +485,20 @@ private function parseNumericValue($bForColor = false) {
485485
486486 private function parseLineNameValue () {
487487 $ this ->consume ('[ ' );
488- $ sName = '' ;
489- try {
490- do {
491- $ this ->consumeWhiteSpace ();
492- $ sName .= $ this -> parseIdentifier ( false , true ) . ' ' ;
493- } while (! $ this ->comes ( ' ] ' ) );
494- } catch (UnexpectedTokenException $ e ) {
495- if (! $ this -> oParserSettings -> bLenientParsing && (! $ sName || ! $ this -> comes ( ' ] ' ))) { // This handles constructs like this [ linename ] in non lenient mode
496- throw $ e ;
488+ $ this -> consumeWhiteSpace () ;
489+ $ aNames = array ();
490+ do {
491+ if ( $ this ->oParserSettings -> bLenientParsing ) {
492+ try {
493+ $ aNames [] = $ this ->parseIdentifier ( false , true );
494+ } catch (UnexpectedTokenException $ e ) {}
495+ } else {
496+ $ aNames [] = $ this -> parseIdentifier ( false , true ) ;
497497 }
498- }
498+ $ this ->consumeWhiteSpace ();
499+ } while (!$ this ->comes ('] ' ));
499500 $ this ->consume ('] ' );
500- return new LineName (rtrim ( $ sName ) , $ this ->iLineNo );
501+ return new LineName ($ aNames , $ this ->iLineNo );
501502 }
502503
503504 private function parseColorValue () {
Original file line number Diff line number Diff line change 22
33namespace Sabberworm \CSS \Value ;
44
5- class LineName extends PrimitiveValue {
6- private $ sName ;
7-
8- public function __construct ($ sName , $ iLineNo = 0 ) {
9- parent ::__construct ($ iLineNo );
10- $ this ->sName = $ sName ;
11- }
12-
13- public function setName ($ sName ) {
14- $ this ->sName = $ sName ;
15- }
16-
17- public function getName () {
18- return $ this ->sName ;
5+ class LineName extends ValueList {
6+ public function __construct ($ aComponents = array (), $ iLineNo = 0 ) {
7+ parent ::__construct ($ aComponents , ' ' , $ iLineNo );
198 }
209
2110 public function __toString () {
2211 return $ this ->render (new \Sabberworm \CSS \OutputFormat ());
2312 }
2413
2514 public function render (\Sabberworm \CSS \OutputFormat $ oOutputFormat ) {
26- return " [ { $ this -> sName } ] " ;
15+ return ' [ ' . parent :: render (\ Sabberworm \ CSS \OutputFormat:: createCompact ()) . ' ] ' ;
2716 }
2817
2918}
You can’t perform that action at this time.
0 commit comments