@@ -350,7 +350,7 @@ public function convertNode(DOMNode $node, int $level = 0): DOMNode
350
350
$ include = $ this ->document ->createTextNode (
351
351
$ this ->builder ->createIncludePartial (
352
352
$ usedComponent ->getPath (),
353
- $ this ->preparePropertiesForInclude ($ usedComponent ->getProperties ()),
353
+ $ this ->preparePropertiesForInclude ($ usedComponent ->getProperties (), $ level === 1 ),
354
354
$ this ->vBind
355
355
)
356
356
);
@@ -414,7 +414,7 @@ public function convertNode(DOMNode $node, int $level = 0): DOMNode
414
414
*
415
415
* @return Property[]
416
416
*/
417
- private function preparePropertiesForInclude (array $ variables ): array
417
+ private function preparePropertiesForInclude (array $ variables, bool $ isRootNode = false ): array
418
418
{
419
419
$ values = [];
420
420
$ hasScopedStyleAttribute = false ;
@@ -457,11 +457,15 @@ private function preparePropertiesForInclude(array $variables): array
457
457
if ($ attribute === 'style ' ) {
458
458
$ glue = ' ~ "; " ~ ' ;
459
459
}
460
- $ variables [] = new Property (
461
- $ attribute ,
462
- $ values [$ attribute ] ?? null ? implode ($ glue , $ values [$ attribute ]) : '"" ' ,
463
- false
464
- );
460
+ $ value = $ values [$ attribute ] ?? null ? implode ($ glue , $ values [$ attribute ]) : '"" ' ;
461
+ if ($ isRootNode ) {
462
+ $ value = $ value . $ glue . $ attribute . '|default( \'\') ' ;
463
+ }
464
+ $ variables [] = new Property ($ attribute , $ value , false );
465
+ }
466
+
467
+ if ($ isRootNode ) {
468
+ $ variables [] = new Property ('dataScopedStyleAttribute ' , 'dataScopedStyleAttribute|default( \'\') ' , false );
465
469
}
466
470
467
471
return $ variables ;
0 commit comments