lwc icon indicating copy to clipboard operation
lwc copied to clipboard

avoid `<slot>` tags as immediate children of strict elements, like ul, tbody, table, etc.

Open Gr8Gatsby opened this issue 7 years ago • 5 comments

SOMA#768

Migrated issue

notes:

This is a note from Hayato about this problem in V1:

The HTML Standard does not guarantee that <ul><slot></slot></ul> work at all. Even if <li> is assigned to a slot, we can not say that <ul> and <li> are in parent-child relationship here. This issue is still in the air.

For now, we should restrict the usage of this in the compiler, so we can relax it later when they solve this issue. Contrary to the <template> tag, which can be used anywhere since it is inert.

Currently parse5 silently fix the markup where the a <slot> is used in a tag having a parent-child relationship. It currently transforms

<template>
    <tbody>
        <slot></slot>
    </tbody>
</template>

into:

<template>
    <tbody></tbody>
    <slot></slot>
</template>

Parse5 strict mode will land with once all the errors are treated in https://github.com/orgs/HTMLParseErrorWG

Gr8Gatsby avatar Apr 25 '18 03:04 Gr8Gatsby

we can implement this right after we close #469

caridy avatar Jul 05 '18 17:07 caridy

This is another silly mistake that folks will face over and over again, lets lint or throw during compilation. /cc @pmdartus @diervo @apapko

caridy avatar Nov 23 '18 16:11 caridy

Any updates ? I spent a lot of time due to that issue, if only i checked the issues here 😭

(btw i'm new in salesforce, i'd like to create a table container component that takes a tbody and generates automatically the thead. Is using slots the right way ?)

LoganTann avatar Apr 14 '22 16:04 LoganTann

Unfortunately, there is no progress on this specific issue.

pmdartus avatar Apr 15 '22 15:04 pmdartus

Unfortunately, there is no progress on this specific issue.

Hello, thanks for the quick reply.

I might have found a quickfix to this problem : Create tables with CSS using div tags only

Since I'm no longer using slots on tables, I haven't tried this workaround.

LoganTann avatar Apr 19 '22 08:04 LoganTann