You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update: this works the same for client-rendering as well: playground.
Note that class and style are inconsistent – they are serialized as '' in the static case, and nonexistent in the dynamic case.
This means that the behavior of getAttribute differs at runtime – either returning '' or null. Also, CSS selectors like [class] or [style] will behave differently.
Steps to Reproduce
git clone git@github.com:nolanlawson/lwc-barebone.git
cd lwc-barebone
git checkout 214418d
yarn dev # go to localhost:3000
Expected Results
Serialized output is the same regardless of whether the vnode is static-optimized or not.
Actual Results
Static optimization leads to different results, only for class and style.
The text was updated successfully, but these errors were encountered:
For the most consistency, and to align with author intention, I think we should serialize the empty string in all cases. If the author put class="", then let's serialize class="".
This issue has been linked to a new work item: W-13520254
nolanlawson
changed the title
[SSR] Inconsistent serialization of empty class/style in static vs dynamic nodes
Inconsistent rendering of empty class/style in static vs dynamic nodes
Jun 1, 2023
Description
The following template HTML:
...results in the following serialized HTML:
Update: this works the same for client-rendering as well: playground.
Note that
class
andstyle
are inconsistent – they are serialized as''
in the static case, and nonexistent in the dynamic case.This means that the behavior of
getAttribute
differs at runtime – either returning''
ornull
. Also, CSS selectors like[class]
or[style]
will behave differently.Steps to Reproduce
Expected Results
Serialized output is the same regardless of whether the vnode is static-optimized or not.
Actual Results
Static optimization leads to different results, only for
class
andstyle
.The text was updated successfully, but these errors were encountered: