File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed
tests/runtime-runes/samples/each-whitespace Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte " : patch
3
+ ---
4
+
5
+ fix: whitespace completely removed in each loop
Original file line number Diff line number Diff line change @@ -41,8 +41,12 @@ export function set_should_intro(value) {
41
41
* @returns {void }
42
42
*/
43
43
export function set_text ( dom , value ) {
44
+ // __nodeValue is ' ' by default...this means that if we are trying to set the value of a node
45
+ // that has never been updated but is already ' ' that node will never be set and it will remain
46
+ // an empty text node.
47
+
44
48
// @ts -expect-error need to add __value to patched prototype
45
- const prev_node_value = dom . __nodeValue ;
49
+ const prev_node_value = dom . nodeValue === dom . __nodeValue ? dom . __nodeValue : dom . nodeValue ;
46
50
const next_node_value = stringify ( value ) ;
47
51
if ( hydrating && dom . nodeValue === next_node_value ) {
48
52
// In case of hydration don't reset the nodeValue as it's already correct.
Original file line number Diff line number Diff line change
1
+ import { flushSync } from 'svelte' ;
2
+ import { test } from '../../test' ;
3
+
4
+ export default test ( {
5
+ html : `<p>space between</p>`
6
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <svelte:options runes />
2
+
3
+ <p >
4
+ {#each [' space' , ' ' , ' between' ] as word }
5
+ {word }
6
+ {/each }
7
+ </p >
You can’t perform that action at this time.
0 commit comments