Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ssr): fix rendering of class attribute #4805

Merged
merged 7 commits into from
Nov 12, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<x-parent>
<template shadowrootmode="open">
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="lwc-5h3d35cke7v">
</div>
<x-grandchild class="lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="bar foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="bar foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="baz foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="baz foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="bar foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="bar foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="bar foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="bar foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="BaR FOO lwc-5h3d35cke7v">
</div>
<x-grandchild class="BaR FOO lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
<x-child class="lwc-5h3d35cke7v-host">
<template shadowrootmode="open">
<style class="lwc-5h3d35cke7v" type="text/css">
:host {background: blue;}
</style>
<div class="foo lwc-5h3d35cke7v">
</div>
<x-grandchild class="foo lwc-5h3d35cke7v">
<template shadowrootmode="open">
</template>
</x-grandchild>
</template>
</x-child>
</template>
</x-parent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-parent';
export { default } from 'x/parent';
export * from 'x/parent';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div
class={dynamic}
></div>
<x-grandchild
class={dynamic}
></x-grandchild>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { LightningElement, api } from 'lwc';

export default class extends LightningElement {
@api dynamic
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {
background: blue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template></template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<template>
<x-child dynamic={isUndefined}></x-child>
<x-child dynamic={isNull}></x-child>
<x-child dynamic={isFalse}></x-child>
<x-child dynamic={isTrue}></x-child>
<x-child dynamic={isZero}></x-child>
<x-child dynamic={isNegZero}></x-child>
<x-child dynamic={isNaN}></x-child>
<x-child dynamic={isInfinity}></x-child>
<x-child dynamic={isNegInfinity}></x-child>
<x-child dynamic={isEmptyString}></x-child>
<x-child dynamic={isArray}></x-child>
<x-child dynamic={isObject}></x-child>
<x-child dynamic={isTwoClasses}></x-child>
<x-child dynamic={isTwoClassesWithSpaces}></x-child>
<x-child dynamic={isUppercase}></x-child>
<x-child dynamic={isTabs}></x-child>
<x-child dynamic={isNewlines}></x-child>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
isUndefined = undefined;
isNull = null;
isFalse = false;
isTrue = true;
isZero = 0;
isNegZero = -0;
isNaN = NaN;
isInfinity = Infinity;
isNegInfinity = -Infinity;
isEmptyString = "";
isArray = ["foo", "bar"];
isObject = {
foo: "bar",
baz: "quux"
};
isTwoClasses = 'foo bar'
isTwoClassesWithSpaces = ' foo bar '
isUppercase = 'FOO BaR'
isTabs = '\tfoo\t'
isNewlines = '\nfoo\n'
}
Loading