From 7834ca3c5badb8f4833bdcf59623cbc27195b3ff Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Wed, 20 May 2020 09:52:27 +0800 Subject: [PATCH 01/11] fix slot with context overflow + without let (#4862) --- .../compile/render_dom/wrappers/Slot.ts | 5 +-- src/runtime/internal/utils.ts | 8 +++++ .../bitmask-overflow-slot-6/Slotted.svelte | 15 +++++++++ .../bitmask-overflow-slot-6/_config.js | 32 +++++++++++++++++++ .../bitmask-overflow-slot-6/main.svelte | 23 +++++++++++++ 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 test/runtime/samples/bitmask-overflow-slot-6/Slotted.svelte create mode 100644 test/runtime/samples/bitmask-overflow-slot-6/_config.js create mode 100644 test/runtime/samples/bitmask-overflow-slot-6/main.svelte diff --git a/src/compiler/compile/render_dom/wrappers/Slot.ts b/src/compiler/compile/render_dom/wrappers/Slot.ts index 55ed031381..268875acaf 100644 --- a/src/compiler/compile/render_dom/wrappers/Slot.ts +++ b/src/compiler/compile/render_dom/wrappers/Slot.ts @@ -172,10 +172,7 @@ export default class SlotWrapper extends Wrapper { const slot_update = b` if (${slot}.p && ${renderer.dirty(dynamic_dependencies)}) { - ${slot}.p( - @get_slot_context(${slot_definition}, #ctx, ${renderer.reference('$$scope')}, ${get_slot_context_fn}), - @get_slot_changes(${slot_definition}, ${renderer.reference('$$scope')}, #dirty, ${get_slot_changes_fn}) - ); + @update_slot(${slot}, ${slot_definition}, #ctx, ${renderer.reference('$$scope')}, #dirty, ${get_slot_changes_fn}, ${get_slot_context_fn}); } `; const fallback_update = has_fallback && fallback_dynamic_dependencies.length > 0 && b` diff --git a/src/runtime/internal/utils.ts b/src/runtime/internal/utils.ts index 487116b655..d752c9de9d 100644 --- a/src/runtime/internal/utils.ts +++ b/src/runtime/internal/utils.ts @@ -103,6 +103,14 @@ export function get_slot_changes(definition, $$scope, dirty, fn) { return $$scope.dirty; } +export function update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) { + const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn); + if (slot_changes) { + const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); + slot.p(slot_context, slot_changes); + } +} + export function exclude_internal_props(props) { const result = {}; for (const k in props) if (k[0] !== '$') result[k] = props[k]; diff --git a/test/runtime/samples/bitmask-overflow-slot-6/Slotted.svelte b/test/runtime/samples/bitmask-overflow-slot-6/Slotted.svelte new file mode 100644 index 0000000000..322a31359e --- /dev/null +++ b/test/runtime/samples/bitmask-overflow-slot-6/Slotted.svelte @@ -0,0 +1,15 @@ + + +
+ + + + {#if open} + + {/if} +
diff --git a/test/runtime/samples/bitmask-overflow-slot-6/_config.js b/test/runtime/samples/bitmask-overflow-slot-6/_config.js new file mode 100644 index 0000000000..8cd8c07a65 --- /dev/null +++ b/test/runtime/samples/bitmask-overflow-slot-6/_config.js @@ -0,0 +1,32 @@ +// overflow bitmask + slot missing `let:` +export default { + html: ` +
+ +
+ + `, + + async test({ assert, component, target, window }) { + const button = target.querySelectorAll('button')[1]; + const div = target.querySelector('div'); + await div.dispatchEvent(new window.MouseEvent('click')); + + assert.htmlEqual(target.innerHTML, ` +
+ +
Open
+
+ + `); + + await button.dispatchEvent(new window.MouseEvent('click')); + assert.htmlEqual(target.innerHTML, ` +
+ +
Open
+
+ + `); + } +}; \ No newline at end of file diff --git a/test/runtime/samples/bitmask-overflow-slot-6/main.svelte b/test/runtime/samples/bitmask-overflow-slot-6/main.svelte new file mode 100644 index 0000000000..8845cb2ef5 --- /dev/null +++ b/test/runtime/samples/bitmask-overflow-slot-6/main.svelte @@ -0,0 +1,23 @@ + + + + + +
+ Open +
+
+ + \ No newline at end of file From 25488772e2a4f96c252a98d1b912b7363b15a1d9 Mon Sep 17 00:00:00 2001 From: Richard Harris Date: Tue, 19 May 2020 21:54:09 -0400 Subject: [PATCH 02/11] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b53d2b4b..2fd3d96fbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Fix resize listening on certain older browsers ([#4752](https://github.com/sveltejs/svelte/issues/4752)) * Add `a11y-no-onchange` warning ([#4788](https://github.com/sveltejs/svelte/pull/4788)) * Add `muted` binding for media elements ([#2998](https://github.com/sveltejs/svelte/issues/2998)) +* Fix let-less `` with context overflow ([#4624](https://github.com/sveltejs/svelte/issues/4624)) ## 3.22.3 From 745c7778060eebc77e38f5d33fac804473d33172 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Thu, 21 May 2020 13:29:55 -0700 Subject: [PATCH 03/11] site: move .dev TLD info from FAQ to readme (#4883) --- README.md | 3 +++ site/content/faq/300-is-svelte-dev-down.md | 5 ----- 2 files changed, 3 insertions(+), 5 deletions(-) delete mode 100644 site/content/faq/300-is-svelte-dev-down.md diff --git a/README.md b/README.md index fa725804a9..0d9b59a4cc 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,9 @@ npm install && npm run update npm run dev ``` +### Is svelte.dev down? + +Probably not, but it's possible. If you can't seem to access any `.dev` sites, check out [this SuperUser question and answer](https://superuser.com/q/1413402). ## License diff --git a/site/content/faq/300-is-svelte-dev-down.md b/site/content/faq/300-is-svelte-dev-down.md deleted file mode 100644 index a7ce9984b7..0000000000 --- a/site/content/faq/300-is-svelte-dev-down.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -question: Is svelte.dev down? ---- - -Probably not, but it's possible. If you can't seem to access any `.dev` sites, check out [this SuperUser question and answer](https://superuser.com/q/1413402). \ No newline at end of file From 97db5cc7f73c97b7a94f4fa5ee8a0a28978e65bc Mon Sep 17 00:00:00 2001 From: Matt Wolff Date: Thu, 21 May 2020 16:33:58 -0400 Subject: [PATCH 04/11] docs: add blur to list of svelte/transition exports --- site/content/docs/03-run-time.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/docs/03-run-time.md b/site/content/docs/03-run-time.md index 56c58634b7..97eabd1146 100644 --- a/site/content/docs/03-run-time.md +++ b/site/content/docs/03-run-time.md @@ -521,7 +521,7 @@ $: $size = big ? 100 : 10; ### `svelte/transition` -The `svelte/transition` module exports six functions: `fade`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with Svelte [`transitions`](docs#transition_fn). +The `svelte/transition` module exports seven functions: `fade`, `blur`, `fly`, `slide`, `scale`, `draw` and `crossfade`. They are for use with Svelte [`transitions`](docs#transition_fn). #### `fade` From f624d6e292e6cf960200ba9ae42e3d5fdf7d7003 Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Thu, 21 May 2020 10:37:29 -1000 Subject: [PATCH 05/11] docs: `value` cannot be set via spread for indirectly bound values (#4832) --- site/content/docs/02-template-syntax.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index 29a2cf75a4..153eb1b4cc 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -121,6 +121,9 @@ An element or component can have multiple spread attributes, interspersed with r ``` + +> The `value` attribute of an `input` element or its children `option` elements must not be set with spread attributes when using `bind:group` or `bind:checked`. Svelte needs to be able to see the element's `value` directly in the markup in these cases so that it can link it to the bound variable. + --- ### Text expressions From e34f2088434423914bbc91b84a450a7f7477252b Mon Sep 17 00:00:00 2001 From: Tan Li Hau Date: Fri, 22 May 2020 04:47:27 +0800 Subject: [PATCH 06/11] reselect ` with `bind:value` when the available `