0

I develop RiotJS wrapper for Bootstrap 4. You can check a live example on Plunker. There is a custom tag

<item>
    <a class="dropdown-item" href="#">
        <yield/>
    </a>
</item>

I use it in the following way: <item>Action</item>. getting the following output:

<item>
    <a class="dropdown-item" href="#"> </a>
    <a class="dropdown-item" href="#"> </a>
    <a class="dropdown-item" href="#"> Action </a>
</item>

Does anyone know why the first 2 empty links are generated and how to avoid them?

Alexander Elgin
  • 6,796
  • 4
  • 40
  • 50

1 Answers1

0

It has do to with the mounting of your tags, along with <yield />. Not sure of the exact issue here, but a solution to your problem is by mounting your outmost tag only, don't mount every single child tag explicitly.

So, in index.html in your example code, replace:

<script> riot.mount('caret'); riot.mount('divider'); riot.mount('heading'); riot.mount('item'); riot.mount('content'); riot.mount('toggle'); riot.mount('dropdown'); </script>

... with:

<script> riot.mount('dropdown'); </script>

Mats Adborn
  • 504
  • 2
  • 7