Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ public function convert(): string
{
$templateElement = $this->document->getElementsByTagName('template')->item(0);
$scriptElement = $this->document->getElementsByTagName('script')->item(0);

/** @var \DOMNodeList $twigBlocks */
$twigBlocks = $this->document->getElementsByTagName('twig');

if ($scriptElement) {
Expand Down Expand Up @@ -340,7 +342,7 @@ private function handleAttributeBinding(DOMElement $node)
$dynamicValues[] = sprintf(
'{{ %s ? \'%s\' }}',
$this->builder->refactorCondition($matchElement['condition']),
$matchElement['class']
$matchElement['class'] . ' '
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/vue-bind/bindings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<input type="radio" checked>
<img src="{{imageSrc}}">
<div class="a b c"></div>
<div class="category-filter-list categories {{ isSomething ? 'block' }} {{ not isSomething ? 'block2' }}"></div>
<div class="category-filter-list categories {{ isSomething ? 'block ' }} {{ not isSomething ? 'block2 ' }}"></div>
</div>
</div>
3 changes: 3 additions & 0 deletions tests/fixtures/vue-bind/double-attribute-binding.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
<div class="static1 static2 dynamic dynamic--{{ modifier }}">
Hello World
</div>
<div class="static1 static2 {{ true ? 'my-class ' }}">
With Object Binding
</div>
</div>
3 changes: 3 additions & 0 deletions tests/fixtures/vue-bind/double-attribute-binding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<div :class="`dynamic dynamic--${modifier}`" class="static1 static2">
Hello World
</div>
<div :class="{ 'my-class': true }" class="static1 static2">
With Object Binding
</div>
</div>
</template>

Expand Down