@@ -120,8 +120,8 @@ export class ElementAnalyzer<TemplateType extends keyof TemplateTypes> {
120
120
return this . _analyze ( node , atRootElement , AnalysisMode . REWRITE ) ;
121
121
}
122
122
123
- analyzeForRewrite ( node : AnalyzableNode , atRootElement : boolean ) : AttrRewriteMap {
124
- return this . _analyze ( node , atRootElement , AnalysisMode . ANALYZE_AND_REWRITE ) ;
123
+ analyzeForRewrite ( node : AnalyzableNode , atRootElement : boolean , forbidNonBlockAttributes = false ) : AttrRewriteMap {
124
+ return this . _analyze ( node , atRootElement , AnalysisMode . ANALYZE_AND_REWRITE , forbidNonBlockAttributes ) ;
125
125
}
126
126
127
127
private debugAnalysis ( node : AnalyzableNode , atRootElement : boolean , element : TemplateElement ) {
@@ -249,21 +249,24 @@ export class ElementAnalyzer<TemplateType extends keyof TemplateTypes> {
249
249
250
250
const attrRewrites = { } ;
251
251
let element = attrRewrites [ "class" ] = this . newElement ( node , mode ) ;
252
-
253
- // The root element gets the block"s root class automatically.
254
- if ( atRootElement ) {
255
- element . addStaticClass ( this . block . rootClass ) ;
256
- }
252
+ let explicitScope = false ;
257
253
258
254
// Find the class or scope attribute and process it
259
255
for ( let analyzableAttr of this . eachAnalyzedAttribute ( node , forbidNonBlockAttributes ) ) {
260
256
if ( analyzableAttr . type === "class" ) {
261
257
this . processClass ( analyzableAttr . namespace , analyzableAttr . property , element , mode ) ;
262
258
} else if ( analyzableAttr . type === "scope" ) {
259
+ explicitScope = analyzableAttr . namespace === DEFAULT_BLOCK_NS ;
263
260
this . processScope ( analyzableAttr . namespace , analyzableAttr . property , element , mode ) ;
264
261
}
265
262
}
266
263
264
+ // The root element gets the block"s root class automatically.
265
+ if ( atRootElement && ! explicitScope ) {
266
+ // TODO: Deprecate this.
267
+ element . addStaticClass ( this . block . rootClass ) ;
268
+ }
269
+
267
270
// validate that html elements aren't using the class attribute.
268
271
if ( isElementNode ( node ) ) {
269
272
for ( let attribute of node . attributes ) {
0 commit comments