11
2- const { isCloseCurlyBrace, isColon, isComma, isComputationallyIndependent, isDelimiter, isOpenCurlyBrace, isSemicolon, isSimpleBlock , isWhitespace } = require ( '../utils/value.js' )
2+ const { isBlock , isCloseCurlyBrace, isColon, isComma, isComputationallyIndependent, isDelimiter, isOpenCurlyBrace, isSemicolon, isWhitespace } = require ( '../utils/value.js' )
33const Stream = require ( './stream.js' )
44const blocks = require ( '../values/blocks.js' )
55const compatibility = require ( '../compatibility.js' )
@@ -396,13 +396,13 @@ function consumeFunction(tokens, { start, value: name }) {
396396 *
397397 * It deviates from the specification by trimming whitespaces.
398398 */
399- function consumeSimpleBlock ( tokens , { start, value : associatedToken } ) {
399+ function consumeBlock ( tokens , { start, value : associatedToken } ) {
400400 const closingToken = blocks . associatedTokens [ associatedToken ]
401401 const value = consumeComponentValueList ( tokens , [ closingToken ] )
402402 if ( ! tokens . consume ( isDelimiter ( closingToken ) ) ) {
403403 error ( { message : 'Unclosed block' } )
404404 }
405- return { associatedToken, end : tokens . current . end , start, types : [ '<simple- block>' ] , value }
405+ return { associatedToken, end : tokens . current . end , start, types : [ '<block>' ] , value }
406406}
407407
408408/**
@@ -413,7 +413,7 @@ function consumeSimpleBlock(tokens, { start, value: associatedToken }) {
413413function consumeComponentValue ( tokens ) {
414414 const current = tokens . consume ( )
415415 if ( blocks . associatedTokens [ current . value ] ) {
416- return consumeSimpleBlock ( tokens , current )
416+ return consumeBlock ( tokens , current )
417417 }
418418 if ( current . types [ 0 ] === '<function-token>' ) {
419419 return consumeFunction ( tokens , current )
@@ -506,11 +506,11 @@ function consumeDeclarationValue(tokens, forCustomProperty, nested) {
506506 continue
507507 }
508508 // Positioned {}-block
509- if ( values . some ( value => ! isWhitespace ( value ) ) && isSimpleBlock ( value , '{' ) ) {
509+ if ( values . some ( value => ! isWhitespace ( value ) ) && isBlock ( value , '{' ) ) {
510510 return
511511 }
512512 const prev = values . findLast ( value => ! isWhitespace ( value ) )
513- if ( prev && isSimpleBlock ( prev , '{' ) ) {
513+ if ( prev && isBlock ( prev , '{' ) ) {
514514 return
515515 }
516516 values . push ( value )
@@ -695,7 +695,7 @@ function consumeAtRule(tokens, context, nested) {
695695 * It deviates from the specification by sorting declarations in specified
696696 * order.
697697 */
698- function consumeBlock ( tokens , context , ignoreCloseCurlyBlock ) {
698+ function consumeBlockContents ( tokens , context , ignoreCloseCurlyBlock ) {
699699 const rules = list ( [ ] , ' ' , '<block-contents>' )
700700 const declarations = [ ]
701701 while ( ! tokens . atEnd ( ) ) {
@@ -898,7 +898,7 @@ function parseRule(input, context) {
898898function parseDeclarationBlock ( input , context ) {
899899 input = normalizeIntoTokens ( input )
900900 context = createContext ( context )
901- const declarations = consumeBlock ( input , context , true ) . filter ( Array . isArray ) . flat ( )
901+ const declarations = consumeBlockContents ( input , context , true ) . filter ( Array . isArray ) . flat ( )
902902 return getDeclarationsInSpecifiedOrder ( declarations )
903903}
904904
@@ -909,7 +909,7 @@ function parseDeclarationBlock(input, context) {
909909 * @see {@link https://drafts.csswg.org/css-syntax-3/#parse-a-blocks-contents }
910910 */
911911function parseBlockContents ( input , context ) {
912- return consumeBlock ( normalizeIntoTokens ( input ) , createContext ( context ) )
912+ return consumeBlockContents ( normalizeIntoTokens ( input ) , createContext ( context ) )
913913}
914914
915915/**
@@ -988,7 +988,7 @@ function parseCSSArbitrarySubstitutionContainingValue(input, context) {
988988 let containsSubstitution = false
989989 for ( let value of input ) {
990990 const { types : [ type ] , value : nested } = value
991- if ( type === '<function>' || type === '<simple- block>' ) {
991+ if ( type === '<function>' || type === '<block>' ) {
992992 if ( type === '<function>' ) {
993993 const match = parseCSSArbitrarySubstitution ( value , context )
994994 if ( match instanceof SyntaxError ) {
0 commit comments