File tree 2 files changed +10
-2
lines changed
packages/@css-blocks/core
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -485,7 +485,15 @@ export class Block
485
485
return [ klass , 0 ] ;
486
486
}
487
487
} else if ( isAttributeNode ( node ) ) {
488
- let attr = this . rootClass . ensureAttributeValue ( toAttrToken ( node ) ) ;
488
+ let prevNode = node . prev ( ) ;
489
+ while ( prevNode && ! ( selectorParser . isClassName ( prevNode ) || isRootNode ( prevNode ) ) ) {
490
+ prevNode = prevNode . prev ( ) ;
491
+ }
492
+ if ( ! prevNode ) {
493
+ throw new Error ( "internal error - illegal selector encountered after validation." ) ;
494
+ }
495
+ let klass = this . getClass ( prevNode . value ) ;
496
+ let attr = klass ?. getAttributeValue ( toAttrToken ( node ) ) ;
489
497
if ( attr ) {
490
498
return [ attr , 0 ] ;
491
499
} else {
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export class BlockNames extends BEMProcessor {
155
155
indented `
156
156
.test-block__bar { }
157
157
.test-block__bar--active { }
158
- .test-block__bar--color.test-block --inverse { background: blue; }
158
+ .test-block__bar--color.test-block__bar --inverse { background: blue; }
159
159
/* Source: foo/bar/test-block.css
160
160
* :scope (.test-block)
161
161
* composes:
You can’t perform that action at this time.
0 commit comments