lwc
lwc copied to clipboard
avoid `<slot>` tags as immediate children of strict elements, like ul, tbody, table, etc.
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
we can implement this right after we close #469
This is another silly mistake that folks will face over and over again, lets lint or throw during compilation. /cc @pmdartus @diervo @apapko
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 ?)
Unfortunately, there is no progress on this specific issue.
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.