Skip to content

Slot comment not parsed correctly

Summary

Under some conditions slot comments in the template are not parsed correctly

Steps to reproduce

<template>
    <div>
        <div>
            <!-- Slot A -->
            <slot name="a">
                <span>A</span>
            </slot>
        </div>
        <div>
            <!-- Slot B -->
            <slot name="b">
                <span>B</span>
            </slot>
        </div>
    </div>
</template>

What is the current bug behavior?

## Slots

| Name | Description |
| ---- | ----------- |
| `a`  | Slot A      |
| `b`  | &nbsp;      |

What is the expected correct behavior?

## Slots

| Name | Description |
| ---- | ----------- |
| `a`  | Slot A      |
| `b`  | Slot B      |

Possible fixes

There is a workaround, add an empty comment before the faulty one:

<template>
    <div>
        <div>
            <!-- Slot A -->
            <slot name="a">
                <span>A</span>
            </slot>
        </div>
        <div>
            <!-- -->
            <!-- Slot B -->
            <slot name="b">
                <span>B</span>
            </slot>
        </div>
    </div>
</template>