File tree Expand file tree Collapse file tree 6 files changed +28
-15
lines changed
runtime-legacy/samples/bindings-coalesced
runtime-runes/samples/each-whitespace Expand file tree Collapse file tree 6 files changed +28
-15
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: always assign text.nodeValue
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export function init_operations() {
36
36
element_prototype . __e = undefined ;
37
37
38
38
// @ts -expect-error
39
- Text . prototype . __nodeValue = ' ' ;
39
+ Text . prototype . __t = undefined ;
40
40
41
41
if ( DEV ) {
42
42
// @ts -expect-error
Original file line number Diff line number Diff line change @@ -36,22 +36,17 @@ export function set_should_intro(value) {
36
36
}
37
37
38
38
/**
39
- * @param {Element } dom
39
+ * @param {Element } text
40
40
* @param {string } value
41
41
* @returns {void }
42
42
*/
43
- export function set_text ( dom , value ) {
44
- // @ts -expect-error need to add __value to patched prototype
45
- const prev_node_value = dom . __nodeValue ;
46
- const next_node_value = stringify ( value ) ;
47
- if ( hydrating && dom . nodeValue === next_node_value ) {
48
- // In case of hydration don't reset the nodeValue as it's already correct.
49
- // @ts -expect-error need to add __nodeValue to patched prototype
50
- dom . __nodeValue = next_node_value ;
51
- } else if ( prev_node_value !== next_node_value ) {
52
- dom . nodeValue = next_node_value ;
53
- // @ts -expect-error need to add __className to patched prototype
54
- dom . __nodeValue = next_node_value ;
43
+ export function set_text ( text , value ) {
44
+ // @ts -expect-error
45
+ const prev = ( text . __t ??= text . nodeValue ) ;
46
+
47
+ if ( prev !== value ) {
48
+ // @ts -expect-error
49
+ text . nodeValue = text . __t = value ;
55
50
}
56
51
}
57
52
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ export default test({
9
9
10
10
Object . defineProperty ( p . childNodes [ 0 ] , 'nodeValue' , {
11
11
set ( value ) {
12
- values . push ( value ) ;
12
+ values . push ( '' + value ) ;
13
13
}
14
14
} ) ;
15
15
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