@@ -445,7 +445,7 @@ function consumeComponentValue(tokens) {
445445 * emitting a parse error when processing `}` while the list is not nested.
446446 */
447447function consumeComponentValueList ( tokens , stops = [ ] ) {
448- const values = list ( [ ] , '' )
448+ const values = [ ]
449449 tokens . consume ( isWhitespace )
450450 while ( ! tokens . atEnd ( ) ) {
451451 if ( isDelimiter ( stops , tokens . next ( ) ) ) {
@@ -456,7 +456,7 @@ function consumeComponentValueList(tokens, stops = []) {
456456 if ( isWhitespace ( values . at ( - 1 ) ) ) {
457457 values . pop ( )
458458 }
459- return values
459+ return list ( values , '' )
460460}
461461
462462/**
@@ -497,7 +497,7 @@ function consumeBadDeclaration(tokens, forCustomProperty, nested) {
497497 * @returns {SyntaxError|object|undefined }
498498 */
499499function consumeDeclarationValue ( tokens , forCustomProperty , nested ) {
500- const values = list ( [ ] , '' )
500+ const values = [ ]
501501 let token
502502 while ( token = tokens . next ( ) ) {
503503 if ( isWhitespace ( token ) ) {
@@ -530,7 +530,7 @@ function consumeDeclarationValue(tokens, forCustomProperty, nested) {
530530 if ( isWhitespace ( values . at ( - 1 ) ) ) {
531531 values . pop ( )
532532 }
533- return values
533+ return list ( values , '' )
534534}
535535
536536/**
@@ -713,7 +713,7 @@ function consumeAtRule(tokens, context, nested) {
713713 * order.
714714 */
715715function consumeBlockContents ( tokens , context , ignoreCloseCurlyBlock ) {
716- const rules = list ( [ ] , ' ' , '<block-contents>' )
716+ const rules = [ ]
717717 const declarations = [ ]
718718 while ( ! tokens . atEnd ( ) ) {
719719 if ( tokens . consume ( isWhitespace ) || tokens . consume ( isSemicolon ) ) {
@@ -756,7 +756,7 @@ function consumeBlockContents(tokens, context, ignoreCloseCurlyBlock) {
756756 if ( 0 < declarations . length ) {
757757 rules . push ( getDeclarationsInSpecifiedOrder ( declarations . splice ( 0 ) ) )
758758 }
759- return rules
759+ return list ( rules , ' ' , '<block-contents>' )
760760}
761761
762762/**
@@ -770,7 +770,7 @@ function consumeBlockContents(tokens, context, ignoreCloseCurlyBlock) {
770770 * instead of in consumeAtRule() or CSSStyleSheet.replace*().
771771 */
772772function consumeStyleSheet ( tokens , context , allowImport ) {
773- const rules = list ( [ ] , ' ' , [ '<block-contents>' ] )
773+ const rules = [ ]
774774 while ( ! tokens . atEnd ( ) ) {
775775 if ( tokens . consume ( token => isDelimiter ( [ ' ' , '<!--' , '-->' ] , token ) ) ) {
776776 continue
@@ -796,7 +796,7 @@ function consumeStyleSheet(tokens, context, allowImport) {
796796 rules . push ( rule )
797797 }
798798 }
799- return rules
799+ return list ( rules , ' ' , [ '<block-contents>' ] )
800800}
801801
802802/**
@@ -852,11 +852,11 @@ function parseCommaSeparatedComponentValueList(input) {
852852 if ( input . atEnd ( ) ) {
853853 return list ( [ ] , ',' )
854854 }
855- const value = list ( [ consumeComponentValueList ( input , [ ',' ] ) ] , ',' )
855+ const value = [ consumeComponentValueList ( input , [ ',' ] ) ]
856856 while ( input . consume ( isComma ) ) {
857857 value . push ( consumeComponentValueList ( input , [ ',' ] ) )
858858 }
859- return value
859+ return list ( value , ',' )
860860}
861861
862862/**
@@ -971,7 +971,7 @@ function parseCSSArbitrarySubstitution(value, context) {
971971 * @returns {SyntaxError|object[]|null }
972972 */
973973function parseCSSArbitrarySubstitutionContainingValue ( input , context ) {
974- const values = list ( [ ] , '' )
974+ const values = [ ]
975975 let containsSubstitution = false
976976 for ( let value of input ) {
977977 const { types : [ type ] , value : nested } = value
@@ -997,7 +997,7 @@ function parseCSSArbitrarySubstitutionContainingValue(input, context) {
997997 }
998998 if ( containsSubstitution ) {
999999 context . globals . set ( 'pending' , true )
1000- return values
1000+ return list ( values , '' )
10011001 }
10021002 input . reset ( )
10031003 return null
@@ -1047,26 +1047,26 @@ function parseCSSWideKeyword(input, context) {
10471047}
10481048
10491049/**
1050- * @param {Stream|string|object[] } value
1050+ * @param {Stream|string|object[] } input
10511051 * @param {object|string } definition
10521052 * @param {CSSRuleImpl|CSSFontFeatureValuesMap|Element|object|string|string[] } [context]
10531053 * @returns {SyntaxError|object|object[]|null }
10541054 * @see {@link https://drafts.csswg.org/cssom-1/#parse-a-css-value }
10551055 */
1056- function parseCSSDeclarationValue ( value , definition , context ) {
1056+ function parseCSSDeclarationValue ( input , definition , context ) {
10571057 if ( typeof input === 'string' ) {
1058- value = new Stream ( parseComponentValueList ( value ) , value )
1059- } else if ( Array . isArray ( value ) ) {
1060- value = new Stream ( value )
1058+ input = new Stream ( parseComponentValueList ( input ) , input )
1059+ } else if ( Array . isArray ( input ) ) {
1060+ input = new Stream ( input )
10611061 }
10621062 context = createContext ( context )
10631063 if ( typeof definition === 'string' ) {
10641064 definition = getDeclarationDefinition ( context , definition )
10651065 }
1066- return parseCSSWideKeyword ( value , context )
1067- ?? parseCSSArbitrarySubstitutionContainingValue ( value , context )
1068- ?? parseCSSGrammar ( value , definition , context )
1069- ?? parseCSSValueSubstitution ( value , context )
1066+ return parseCSSWideKeyword ( input , context )
1067+ ?? parseCSSArbitrarySubstitutionContainingValue ( input , context )
1068+ ?? parseCSSGrammar ( input , definition , context )
1069+ ?? parseCSSValueSubstitution ( input , context )
10701070}
10711071
10721072/**
0 commit comments