Additional Details
The nuxt-link component contains only the two children items.
The dom is expected to show:
<a>
first child item
<a href="/">anchor tag child item</a>
</a>
The nuxt-link component returns the two children items expected, but also returns a duplicate of the anchor tag child item.
As a result the dom shows:
<a>
first child item
<a href="/">anchor tag child item</a>
</a>
<a href="/">anchor tag child item</a>
You can't nest anchor tags inside NuxtLink tags (as the latter will be rendered as an anchor tag as well). That's invalid HTML
It does seem weird that the NuxtLink would replicate the child anchor tag, I'm not sure how/why that's happening. The RouterLink in vue router seems to allow it.
@smooty It does render what you are expecting. Try looking at the raw HTML returned by the server.
<a href="/about" class="button--grey">
link
<a href="https://nuxtjs.org/" target="_blank" class="button--green">replicated anchor tag</a></a>
But the browser realises that it is bad HTML and tries to correct it, which ultimately results in a differing DOM.
@danielroe interesting, thank you for the explanation!
Most helpful comment
@smooty It does render what you are expecting. Try looking at the raw HTML returned by the server.
But the browser realises that it is bad HTML and tries to correct it, which ultimately results in a differing DOM.