Skip to content

Commit

Permalink
fix(ssr): fix rendering of class attribute (#4805)
Browse files Browse the repository at this point in the history
Co-authored-by: Will Harney <62956339+wjhsf@users.noreply.github.com>
  • Loading branch information
nolanlawson and wjhsf authored Nov 12, 2024
1 parent 5bf5d91 commit bf231db
Show file tree
Hide file tree
Showing 44 changed files with 981 additions and 80 deletions.
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

0 comments on commit bf231db

Please sign in to comment.