status
stringclasses
1 value
repo_name
stringlengths
9
24
repo_url
stringlengths
28
43
issue_id
int64
1
104k
updated_files
stringlengths
8
1.76k
title
stringlengths
4
369
body
stringlengths
0
254k
⌀
issue_url
stringlengths
37
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[ns, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,675
["src/shared/index.js", "src/shared/transitions.js", "src/shared/utils.js", "test/runtime/samples/transition-js-context/_config.js", "test/runtime/samples/transition-js-context/main.html"]
Run transitions in context of component
I just tried to do this, to prevent a transition from running when a component is first rendered (in a situation where `skipIntroByDefault` isn't an option): ```js export default { transitions: { grow(node, params) { const { started } = this.get(); if (!started) { return { duration: 0 }; } const style = getComputedStyle(node); const w = parseFloat(style.width); const h = parseFloat(style.height); return { duration: 600, easing: eases.cubicOut, css: t => `opacity: ${t}; width: ${t * w}px; height: ${t * h}px;` }; } } }; ``` That doesn't work, because transition functions aren't called with `component` as context. In this case it was easy to fix by passing `started` as a parameter, but that wouldn't always be the case. We could change [this line](https://github.com/sveltejs/svelte/blob/9eec6f8c72609304e4830e625f5c60aa387851f6/src/shared/transitions.js#L30): ```diff export function wrapTransition(component, node, fn, params, intro) { - let obj = fn(node, params); + let obj = fn.call(component, node, params); let duration; let ease; ``` Any reason not to?
https://github.com/sveltejs/svelte/issues/1675
https://github.com/sveltejs/svelte/pull/1680
e450c3094371161495d0dcb84b777438a4f3e687
c2642bdf116a02d8490d5a6dc7d09f6fce5cca20
2018-08-22T18:43:10Z
javascript
2018-08-24T01:46:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,666
["src/compile/nodes/Attribute.ts", "test/js/samples/select-dynamic-value/expected-bundle.js", "test/js/samples/select-dynamic-value/expected.js", "test/js/samples/select-dynamic-value/input.html"]
Select does not get value of prop right after rendering
I am trying to interact with select tag by setting value with prop and getting it with on change event. I found some unexpected behavior: 1. After rendering, select does not get the value of prop, value of select changing only after changing the value of prop 2. The same situation with prop from store. On the other hand if it is two-way binding, select is rendered with proper value. [https://svelte.technology/repl?version=2.11.0&gist=9bfb91057035f3fa96e0cacd0f122b63](https://svelte.technology/repl?version=2.11.0&gist=9bfb91057035f3fa96e0cacd0f122b63)
https://github.com/sveltejs/svelte/issues/1666
https://github.com/sveltejs/svelte/pull/1681
ed9a9a9530d499eb23d1968eb77c21a5fc1ef8b8
ff6c4c7767d47fbc4440a9a50cfb6e4c7a01092d
2018-08-18T22:52:20Z
javascript
2018-08-24T23:47:09Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,660
["src/compile/nodes/Component.ts", "test/cli/samples/amd/expected/Main.js", "test/runtime/samples/dynamic-component-destroy-null/_config.js", "test/runtime/samples/dynamic-component-destroy-null/main.html"]
outtroBlock issue causes dynamic components with each block to not be destroyed
My app seems to be running into this edge case. I don't yet have an isolated reproduction of the issue, but I do have some generated output that has the bug with the fix. This causes the issue. The problem is `each_blocks[i]` is set to null & outroBlock is called two times. The first invocation does not have the `fn` argument and the second invocation does (however, `each_blocks[i]` is `null`). ```javascript function outroBlock(i, detach, fn) { if (each_blocks[i]) { each_blocks[i].o(function () { if (detach) { each_blocks[i].d(detach) each_blocks[i] = null } if (fn) { fn() } }) } } ``` This seems to work: ```javascript function outroBlock(i, detach, fn) { if (each_blocks[i]) { each_blocks[i].o(function () { if (detach) { each_blocks[i].d(detach) each_blocks[i] = null } if (fn) { fn() } }) } else { if (fn) { fn() } } } ```
https://github.com/sveltejs/svelte/issues/1660
https://github.com/sveltejs/svelte/pull/1677
3778431775eb42f32ad5a5485293bf1ac12ce16a
ba7a6c9bc1397c6bd90f7367c85b4eaa5bd7c0f7
2018-08-16T23:17:31Z
javascript
2018-08-23T03:09:40Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,659
["src/compile/nodes/DebugTag.ts", "src/shared/ssr.js", "test/js/samples/debug-ssr-foo/_config.js", "test/js/samples/debug-ssr-foo/expected-bundle.js", "test/js/samples/debug-ssr-foo/expected.js", "test/js/samples/debug-ssr-foo/input.html"]
DebugTag doesn't work in SSR mode
It doesn't declare an `ssr` method
https://github.com/sveltejs/svelte/issues/1659
https://github.com/sveltejs/svelte/pull/1682
09865ebbede99cecc02ad02806de7af7bb376235
ed9a9a9530d499eb23d1968eb77c21a5fc1ef8b8
2018-08-16T21:51:49Z
javascript
2018-08-24T23:41:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,658
["src/validate/html/index.ts", "test/validator/samples/non-empty-block-dev/_config.js", "test/validator/samples/non-empty-block-dev/input.html", "test/validator/samples/non-empty-block-dev/warnings.json"]
Empty if block with ` `
[REPL](https://svelte.technology/repl?version=2.11.0&gist=59259019662bfb5bfd64df819dcdc90a) The template: ```html {#if foo} &nbsp; {:else} <p>not foo!</p> {/if} ``` Gives the following warning: ![image](https://user-images.githubusercontent.com/12702016/44234680-90f8ab80-a17d-11e8-9a1a-cc214a70ca60.png)
https://github.com/sveltejs/svelte/issues/1658
https://github.com/sveltejs/svelte/pull/1683
fe8e31a592701257a7929cbde411077da6d714b5
09865ebbede99cecc02ad02806de7af7bb376235
2018-08-16T20:55:59Z
javascript
2018-08-24T23:41:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,621
["src/compile/nodes/Component.ts", "test/runtime/samples/dynamic-component-in-if/Bar.html", "test/runtime/samples/dynamic-component-in-if/Foo.html", "test/runtime/samples/dynamic-component-in-if/_config.js", "test/runtime/samples/dynamic-component-in-if/main.html"]
Nested <svelte:component> in {#if} statements don't always update the DOM when this changes.
https://svelte.technology/repl?version=2.9.7&gist=ecddb3e75c5ef632b983a72f73ebff8b If you click through you'll see that 1, 2, 3 do not render the correct component.
https://github.com/sveltejs/svelte/issues/1621
https://github.com/sveltejs/svelte/pull/1630
6012c965ac7ec20841f823d60ddabd620661aaa6
7c5109401239d6e2e89e033c3b6e90f15f5bbe47
2018-07-28T23:48:32Z
javascript
2018-08-04T20:55:25Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,618
["src/css/Selector.ts", "test/css/samples/local-inside-global/expected.css", "test/css/samples/local-inside-global/input.html"]
:global(selector1) selector2 { ... } - selector2 is not scoped to component
``` :global(selector1) selector2 { ... } ``` compiles to ``` selector1 selector2 { ... } ``` which seems strange to me. I'd expect it to be `selector1 selector2.svelte-hash`. There doesn't currently seem to be a way to achieve that. This feels like a bug to me, but I can't be certain what the intended behavior is here. cc @kaisermann @arxpoetica
https://github.com/sveltejs/svelte/issues/1618
https://github.com/sveltejs/svelte/pull/1631
7c5109401239d6e2e89e033c3b6e90f15f5bbe47
65aae85fed508d7f0891d99f8e643292a106bfd2
2018-07-26T17:09:42Z
javascript
2018-08-04T23:39:59Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,617
["src/compile/nodes/EachBlock.ts", "test/runtime/samples/transition-js-each-block-outro/_config.js", "test/runtime/samples/transition-js-nested-each-delete/_config.js", "test/runtime/samples/transition-js-nested-each-delete/main.html"]
Nested transitions prevent items from being removed
Looks like there is some stale state somewhere, and Svelte thinks items are in the process of being removed (or something) https://svelte.technology/repl?version=2.9.7&gist=1b5b2cc92dfb9af877487c464739df0f
https://github.com/sveltejs/svelte/issues/1617
https://github.com/sveltejs/svelte/pull/1693
c7d372c8d55bc66f541ca4a324d48cebe0c2a360
b4a3a60953b82559e03b5204071d425a9e87ef42
2018-07-26T11:59:47Z
javascript
2018-08-28T19:12:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,614
[".travis.yml", "README.md", "package-lock.json"]
Contributor onboarding
Just to capture some discussion currently happening on Discord: * we should use package-lock.json instead of yarn.lock — this means contributors don't need to know about yarn (it also means we can use `npm ci` for a speed boost) * need a 'how to run locally/how to add tests' section on the README * need to introduce people to TypeScript (i.e. it's just JS but you will need an editor extension if you're not using VSCode) any other stuff?
https://github.com/sveltejs/svelte/issues/1614
https://github.com/sveltejs/svelte/pull/1632
e35f174207ff1c0c4aae72699272019ee4b15ce6
fbce3282294f1ca0ebc86c2c627ff92aa7f6e3e1
2018-07-25T15:28:02Z
javascript
2018-08-05T01:57:18Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,605
["src/compile/nodes/Component.ts", "src/shared/ssr.js"]
<svelte:component this={null}/> fails in SSR mode
In the [REPL](https://svelte.technology/repl?version=2.9.5&gist=f90500f365e344bd15ae7f50dc7445d0), we get an error — > missingComponent is not defined — and in my local project I'm seeing > _WEBPACK_GARBLE___default.a.data is not a function
https://github.com/sveltejs/svelte/issues/1605
https://github.com/sveltejs/svelte/pull/1606
cc93595dac08b1e0f51ad2f1dbd0d118fbbbc2b1
593bb0367fd7de36af86cc0f27bfb9264611748e
2018-07-20T17:03:26Z
javascript
2018-07-21T20:56:12Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,596
["src/compile/nodes/Component.ts", "test/runtime/samples/dynamic-component-nulled-out/Foo.html", "test/runtime/samples/dynamic-component-nulled-out/_config.js", "test/runtime/samples/dynamic-component-nulled-out/main.html"]
Dynamic component instances aren't nulled out if they no longer exist
resulting in bugs like this: https://svelte.technology/repl?version=2.9.4&gist=548cb46d598080e13992ccacb9989a10 This affects the forthcoming version of Sapper. AFAICT it's an easy fix — PR inbound
https://github.com/sveltejs/svelte/issues/1596
https://github.com/sveltejs/svelte/pull/1597
63e64c6f42b16fe00f316d128f814a051bda3b9b
8060f281de58c35f0412b9cab8f0b73163aea4ce
2018-07-17T17:56:20Z
javascript
2018-07-17T20:42:24Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,589
["src/compile/nodes/IfBlock.ts", "test/runtime/samples/if-block-no-outro-else-with-outro/Widget.html", "test/runtime/samples/if-block-no-outro-else-with-outro/_config.js", "test/runtime/samples/if-block-no-outro-else-with-outro/main.html"]
Uncaught ReferenceError: current is not defined
### Steps to reproduce 1. Open gist: https://svelte.technology/repl?version=2.9.3&gist=906410361695020ab832e410780acc69 2. Type something in the text box 3. Look at the console for the error This only happens when the else block has a nested component. And, only when `nestedTransitions == true`. Seems like it is referencing an undefined variable called `current` in Else block's `p: update()` method.
https://github.com/sveltejs/svelte/issues/1589
https://github.com/sveltejs/svelte/pull/1612
264d65d52c3d166b41d455ac0a627e9c8184830a
01a099d2e68110026e94268ef3503d6a705c5f04
2018-07-10T14:31:48Z
javascript
2018-07-24T17:23:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,581
["src/compile/nodes/Element.ts", "test/runtime/samples/attribute-dynamic-no-dependencies/_config.js", "test/runtime/samples/attribute-dynamic-no-dependencies/main.html"]
Over-permissive logic for .innerHTML optimizations
See https://github.com/simonlayfield/svelte-each-index - Svelte is using the .innerHTML optimization when it shouldn't. The `{i}`s in the loop should be dynamic. As of #1499 this won't be reproducible in dev mode / in the repl. cc @simonlayfield
https://github.com/sveltejs/svelte/issues/1581
https://github.com/sveltejs/svelte/pull/1582
2edc56b91996288f1a86c3fe409d8e3d85dc7e8f
909536dac9c8597af93dac1f9c3d99b47d784087
2018-07-08T03:12:29Z
javascript
2018-07-08T15:58:33Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,580
["src/compile/nodes/IfBlock.ts", "test/runtime/samples/if-block-outro-unique-select-block-type/Component.html", "test/runtime/samples/if-block-outro-unique-select-block-type/_config.js", "test/runtime/samples/if-block-outro-unique-select-block-type/main.html"]
if_block_creators[current_block_type_index] is not a function
I was trying to create component with several if-else statements, that depends on component data variable. First statement block should add one of nested components, second statement block should add some button tags. I got an error **if_block_creators[current_block_type_index] is not a function** https://svelte.technology/repl?version=2.9.1&gist=6e02554521c9ea732c3b7e8a883ef664
https://github.com/sveltejs/svelte/issues/1580
https://github.com/sveltejs/svelte/pull/1584
909536dac9c8597af93dac1f9c3d99b47d784087
a2368cde46f8b19ad98ef8cf4e175a2415fedebd
2018-07-08T00:49:26Z
javascript
2018-07-08T15:58:45Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,579
["src/compile/render-dom/wrappers/Window.ts"]
FF Mobile & Safari - ScrollY binding performance issue
Hi, I took a template and I removed all the jQuery and redoing everything in svelte+sapper. This is just a POC to give as a starting base to a team who's going to actually make it. Link: https://wgmsacom-hyuydhwlgb.now.sh/ It's using `<svelte:window bind:scrollY=scrollY/>` and then to calculate when it's on certain scroll position. ``` onstate({ changed, current, previous }) { if (changed.scrollY) { this.set({ isTransparent: current.scrollY < 65 }); } } ``` Works fine everywhere, but it used to be slow on my S8 when i was using a `computed property` to do the calc, after that, replaced it with onstate and got it smooth everywhere, except in the iPhone SE that i have available (thanks hun) where it runs like a potato 🥔. I removed the binding and scrolls up and down smoothly again. My question, Can it be an issue with iOS, Safari and/or the scroll binding? PD: if the link is down, it's my fault. Just ask and I will `now` it ASAP. Thanks
https://github.com/sveltejs/svelte/issues/1579
https://github.com/sveltejs/svelte/pull/1770
d06088c33392b0ac5d39df7db203ddd0bb8e4c5e
cbfcde3cdee4dab08fe2243750ea52bd5e64140c
2018-07-06T23:49:44Z
javascript
2018-10-17T15:24:53Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,575
["src/compile/dom/Block.ts", "src/compile/nodes/IfBlock.ts", "test/runtime/samples/transition-js-if-block-outro-timeout/_config.js", "test/runtime/samples/transition-js-if-block-outro-timeout/main.html"]
Any set({}) during transition back transition element to previous state.
It's happening because we not check current transition state and run groupOutros() again with set remaining to 0. Looks like a classic race condition. REPL: https://svelte.technology/repl?version=2.9.1&gist=9436b31a1bdc913ec008e96a18eb19f0 it's working fine for 2.8.1 because we create a new object instead of change parameters in the existing object. Problem in this commit: https://github.com/sveltejs/svelte/pull/1569/commits/7678b36581a200a8376b16960eb9f73e25f2bb9d
https://github.com/sveltejs/svelte/issues/1575
https://github.com/sveltejs/svelte/pull/1585
7cab338e32ead4acbd507a820d93d6ec6243d033
0dcc0f2062d4a0fe810aa2cb405392b3914012fc
2018-07-03T04:38:47Z
javascript
2018-07-09T02:28:40Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,571
["src/compile/nodes/Element.ts", "test/runtime/samples/template/_config.js", "test/runtime/samples/template/main.html"]
<template> innerHTML is empty
[REPL](https://svelte.technology/repl?version=2.8.1&gist=3514780be4b12b55811bf8df1fc557b4) Basically, it should work: [JSFIDDLE](http://jsfiddle.net/hwL2qv75/2/)
https://github.com/sveltejs/svelte/issues/1571
https://github.com/sveltejs/svelte/pull/1574
2bb62c3436038a442d27953287a25c6a1b1adddd
06451bafd0fb3f84fc28d55289c5ffca19476cef
2018-06-29T05:51:38Z
javascript
2018-07-01T19:40:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,565
["src/compiler/compile/render_dom/wrappers/Element/index.ts", "test/runtime/samples/each-block-scope-shadow-self/_config.js", "test/runtime/samples/each-block-scope-shadow-self/main.svelte"]
{#each x as x} with bind: mutates x
Using {#each x as x} is not only stupid, it's also dangerous, as this [REPL](https://svelte.technology/repl?version=2.8.1&gist=46d2cd092434001b2b0941b9157aeecd) shows. If you type into any input, data.x changes from array to an element of itself. I think the compiler could either guard against this or leave my data alone and just let me write the occasional dumb code.
https://github.com/sveltejs/svelte/issues/1565
https://github.com/sveltejs/svelte/pull/3698
36ca31150048fbe86aea7038853d7c2826f00a62
982a1937db9001ec3bba4928416e0816fa8e2848
2018-06-27T11:41:10Z
javascript
2019-10-16T20:48:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,561
["src/compile/nodes/Element.ts", "src/shared/transitions.js", "test/runtime/samples/transition-js-destroyed-before-end/_config.js", "test/runtime/samples/transition-js-destroyed-before-end/main.html"]
Transition bug upon component destroy
If a component is destroyed (`.destroy()`) while still having transitions, it throws an error. It seems the issue is that since `out` transitions delay the element removal, if in the meantime you actually destroy the component (removing it from DOM), when the animation ends and element removal fires, the element to remove doesn't exists anymore. Here is a REPL showing the behavior, with instructions: https://svelte.technology/repl?version=2.8.1&gist=0e08b210aba2e0c447c003671eb3ed6c
https://github.com/sveltejs/svelte/issues/1561
https://github.com/sveltejs/svelte/pull/1572
5c6e7e878c6b074558a0afb98102847f1f0e2206
faa07e8d578da7aa9eac56b968104732f7437a59
2018-06-25T20:59:42Z
javascript
2018-06-29T21:50:26Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,559
["src/compile/nodes/EachBlock.ts", "src/compile/nodes/ElseBlock.ts", "test/runtime/samples/each-block-else-mount-or-intro/Widget.html", "test/runtime/samples/each-block-else-mount-or-intro/_config.js", "test/runtime/samples/each-block-else-mount-or-intro/main.html"]
each_else.i is not a function
REPL: https://svelte.technology/repl?version=2.8.1&gist=d929e4517407a49609079c0fabc4ad0f Only if an array is empty.
https://github.com/sveltejs/svelte/issues/1559
https://github.com/sveltejs/svelte/pull/1586
e66d9ffae75928c8da96050b077385a343114a6c
26dfb9afa73c5fd564bbd5efbfc6155a0e9930e9
2018-06-24T20:50:20Z
javascript
2018-07-09T17:02:17Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,540
["src/compile/Compiler.ts", "src/compile/dom/index.ts", "src/shared/utils.js", "src/utils/annotateWithScopes.ts", "test/runtime/samples/object-rest/_config.js", "test/runtime/samples/object-rest/main.html"]
Object rest support
The rest operator breaks the Svelte parser right now: https://svelte.technology/repl?version=2.7.2&gist=5cfe2e66a18895f0d8956fdd8ff45d0a Maybe this would be fixed by bumping the acorn version? It's supposed to be supported in acorn ^5.4.1, but there have been some bug fixes to the spread operator since then, so who knows. https://github.com/acornjs/acorn/blob/master/CHANGELOG.md
https://github.com/sveltejs/svelte/issues/1540
https://github.com/sveltejs/svelte/pull/1628
65aae85fed508d7f0891d99f8e643292a106bfd2
e35f174207ff1c0c4aae72699272019ee4b15ce6
2018-06-13T15:19:29Z
javascript
2018-08-04T23:40:27Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,532
["src/shared/utils.js", "test/runtime/samples/each-block-empty-outro/Thing.html", "test/runtime/samples/each-block-empty-outro/_config.js", "test/runtime/samples/each-block-empty-outro/main.html"]
Empty lists with transitions prevent DOM from being removed
[REPL](https://svelte.technology/repl?version=2.7.1&gist=87122d2f34f1b5ed6cf34f5fb008a390). The outro callback is never called if the list is empty.
https://github.com/sveltejs/svelte/issues/1532
https://github.com/sveltejs/svelte/pull/1533
b76f0744019dabc6ba0468f9bca8c5f501fc7d02
65592aac76c148028ed510e88904ebea47f57a13
2018-06-08T13:30:04Z
javascript
2018-06-08T13:38:34Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,527
["src/compile/dom/Block.ts", "src/compile/nodes/Attribute.ts", "src/compile/nodes/Title.ts", "src/compile/nodes/shared/Tag.ts", "test/runtime/samples/nested-transition-if-block-not-remounted/Span.html", "test/runtime/samples/nested-transition-if-block-not-remounted/_config.js", "test/runtime/samples/nested-transition-if-block-not-remounted/main.html"]
Nested transitions cause inputs to lose focus
See the [REPL](https://svelte.technology/repl?version=2.7.1&gist=ba601f15c9b99c3aee760bf15f3b27a6). It looks like the issue is that the `<input>` is getting remounted because the `if` block's intro method is being called, and there's no check in place to ensure that it's necessary to do so
https://github.com/sveltejs/svelte/issues/1527
https://github.com/sveltejs/svelte/pull/1529
f1cfa55efcb8f4abab949aeb0353d6bf68d25041
b76f0744019dabc6ba0468f9bca8c5f501fc7d02
2018-06-06T18:18:26Z
javascript
2018-06-08T13:25:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,515
["src/compile/nodes/Component.ts", "src/compile/nodes/Element.ts", "test/runtime/samples/spread-component-multiple-dependencies/Widget.html", "test/runtime/samples/spread-component-multiple-dependencies/_config.js", "test/runtime/samples/spread-component-multiple-dependencies/main.html", "test/runtime/samples/spread-element-multiple-dependencies/_config.js", "test/runtime/samples/spread-element-multiple-dependencies/main.html"]
Using {...spread} alongside ternary errors out
[REPL](https://svelte.technology/repl?version=2.7.0&gist=a189e5e7181ed608a837a6a614a4dd25) If you have some attribute defined by a ternary operator and try to spread some object, this happens: ![image](https://user-images.githubusercontent.com/12702016/40729214-488fffe6-6402-11e8-91d2-708668ba8495.png)
https://github.com/sveltejs/svelte/issues/1515
https://github.com/sveltejs/svelte/pull/1516
7032ec745cdf17f25c47659ebb989c88fe24a157
2e4ce7576803d28c62f620cb6676a73642250348
2018-05-30T15:09:27Z
javascript
2018-06-05T20:56:28Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,513
["src/parse/state/tag.ts", "test/validator/samples/attribute-expected-equals/errors.json", "test/validator/samples/attribute-expected-equals/input.svelte"]
attr"value" generates incorrect code, instead of failing
[REPL](https://svelte.technology/repl?version=2.7.0&gist=4fd2c969ccef2c9a6b71bb9895c9b74b)
https://github.com/sveltejs/svelte/issues/1513
https://github.com/sveltejs/svelte/pull/2770
98122bc577f4b23ae92bd372f893b8544eb71e34
1dc0eb02f2c4d184bf76ce62d79d6dff25bd1d30
2018-05-29T19:22:59Z
javascript
2019-05-15T21:49:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,504
["src/css/Stylesheet.ts", "src/utils/isKeyframesNode.ts", "test/css/samples/keyframes-autoprefixed/expected.css", "test/css/samples/keyframes-autoprefixed/input.html"]
Prefixed @keyframes are not transformed
Prefixed `@keyframes` don't have their name transformed. [REPL](https://svelte.technology/repl?version=2.6.6&gist=6c50827ab2758a8fe3b10f58f67a9d54) The generated css is: ```css h1.svelte-1vhi2c7{ -webkit-animation:grow 2s infinite; -moz-animation:grow 2s infinite; -o-animation:grow 2s infinite; animation:svelte-1vhi2c7-grow 2s infinite } @-webkit-keyframes grow {} @-moz-keyframes grow {} @-o-keyframes grow {} @keyframes svelte-1vhi2c7-grow{0%{font-size:12px }50%{font-size:40px}100%{font-size:12px}} ```
https://github.com/sveltejs/svelte/issues/1504
https://github.com/sveltejs/svelte/pull/1505
497a52278036a8ef26242acca4eafc1ef1014433
024530ed53cd13425fbe9876c8d7b55aa8581ddd
2018-05-27T19:03:30Z
javascript
2018-05-28T22:55:48Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,502
["src/compile/nodes/Window.ts"]
<svelte:window bind:online/> doesn't work in dev mode
[REPL](https://svelte.technology/repl?version=2.6.6&gist=05582022f7d4dc4e679439b8c34ab3b2). Try going to the devtools network tab and toggling the online state — it fails with the following: > Uncaught Error: <App>: Cannot set read-only property 'online'
https://github.com/sveltejs/svelte/issues/1502
https://github.com/sveltejs/svelte/pull/1503
024530ed53cd13425fbe9876c8d7b55aa8581ddd
25378642931d60fc1fc1e1775f11e6ec09f6e008
2018-05-27T00:47:30Z
javascript
2018-05-28T22:56:12Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,497
["src/compile/nodes/AwaitBlock.ts", "src/compile/nodes/EachBlock.ts", "src/compile/nodes/IfBlock.ts", "test/runtime/samples/nested-transition-detach-each/_config.js", "test/runtime/samples/nested-transition-detach-each/main.html", "test/runtime/samples/nested-transition-detach-if-false/Folder.html", "test/runtime/samples/nested-transition-detach-if-false/_config.js", "test/runtime/samples/nested-transition-detach-if-false/main.html"]
Another nestedTransitions bug
[REPL](https://svelte.technology/repl?version=2.6.5&gist=eda1eecbbd0d218b3f0e17817e8348a2)
https://github.com/sveltejs/svelte/issues/1497
https://github.com/sveltejs/svelte/pull/1498
29ec07eefe32411bc455972cdb2d0874fd479478
c5544b7faf19ae3dc53524351194fd098c42b404
2018-05-25T17:30:22Z
javascript
2018-05-25T23:28:33Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,489
["src/compile/nodes/Component.ts", "test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html", "test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html", "test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js", "test/runtime/samples/dynamic-component-bindings-recreated-b/main.html"]
<svelte:component> bindings don't run on change
Sibling issue to #1488 — when a `<svelte:component>` is first created, Svelte runs `_bind`. But that doesn't happen when the `this` value changes. [REPL](https://svelte.technology/repl?version=2.6.3&gist=44ee86d9f03e5dbca311e3b3782aab4f)
https://github.com/sveltejs/svelte/issues/1489
https://github.com/sveltejs/svelte/pull/1490
80077c13c384efd889ccaf5579440922a76ff0b4
012289a4c29337d863b0b39cb386e4b9994dc00a
2018-05-24T11:59:55Z
javascript
2018-05-24T21:32:57Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,488
["src/compile/nodes/Component.ts", "test/runtime/samples/dynamic-component-bindings-recreated-b/Green.html", "test/runtime/samples/dynamic-component-bindings-recreated-b/Red.html", "test/runtime/samples/dynamic-component-bindings-recreated-b/_config.js", "test/runtime/samples/dynamic-component-bindings-recreated-b/main.html"]
component.set({ foo: undefined }) should 'unset' foo
In the following case... ```html <svelte:component this={Whatever} bind:foo/> ``` ...it's very likely that when `Whenever` changes, you don't want the new component to have the value of `foo` from the old component imposed upon it. But if you try to clear the value... ```js this.set({ foo: undefined }); this.set({ Whatever: SomeNewComponent }); ``` ...then the `SomeNewComponent` instance is initialised with `foo: undefined` rather than being able to use its default value, which is what you want in that situation. The workaround is somewhat hacky: ```js delete this._state.foo; this.set({ Whatever: SomeNewComponent }); ``` I'd argue that the current behaviour is a bug, and that `undefined` values should be deleted from the state object automatically. Outside of the `<svelte:component>` case, I don't think it would result in any different outcomes.
https://github.com/sveltejs/svelte/issues/1488
https://github.com/sveltejs/svelte/pull/1490
80077c13c384efd889ccaf5579440922a76ff0b4
012289a4c29337d863b0b39cb386e4b9994dc00a
2018-05-24T11:58:09Z
javascript
2018-05-24T21:32:57Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,487
["src/Stats.ts"]
Doesn't run in a web worker
[This code](https://github.com/sveltejs/svelte/blob/d03693114df5898740cd4a44f42531b02f2239fb/src/Stats.ts#L4-L9) doesn't run in a web worker due to the `window` reference. It's preventing StackBlitz from upgrading to v2. It should probably use `self` instead
https://github.com/sveltejs/svelte/issues/1487
https://github.com/sveltejs/svelte/pull/1491
012289a4c29337d863b0b39cb386e4b9994dc00a
73eadb16306598c8f296f53ec65361f6d1c19163
2018-05-24T00:25:06Z
javascript
2018-05-24T21:47:10Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,470
["src/compile/dom/index.ts", "test/runtime/samples/if-block-component-without-outro/Widget.html", "test/runtime/samples/if-block-component-without-outro/_config.js", "test/runtime/samples/if-block-component-without-outro/main.html"]
Error with transition changes in 2.6.1
See https://svelte.technology/repl?version=2.6.1&gist=7b57b551d51b754e048a2fab07c18459 Components within an if-statement throw an error: ``` component1._fragment.o is not a function ```
https://github.com/sveltejs/svelte/issues/1470
https://github.com/sveltejs/svelte/pull/1479
3f6d0e7b0ea23703178785367ff4271ac62711a0
8b20837e2aa66cea59682e64a46a3f3012eb85da
2018-05-15T21:58:27Z
javascript
2018-05-17T02:04:24Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,461
["src/compile/nodes/Component.ts", "src/compile/nodes/Element.ts", "src/compile/nodes/Slot.ts", "src/utils/quoteIfNecessary.ts", "test/runtime/samples/component-slot-name-with-hyphen/Nested.html", "test/runtime/samples/component-slot-name-with-hyphen/_config.js", "test/runtime/samples/component-slot-name-with-hyphen/main.html"]
Slot names are not escaped correctly
When creating slots, it appears that the slot name is not escaped correctly if the name doesn't follow Javascript naming conventions. For example: ``` <slot name="some-slot"></slot> ``` results in an error similar to: ``` ERROR in ./component/BasePage.sv.html Module build failed: SyntaxError: component/BasePage.sv.html: Unexpected token, expected ";" (14:27) 12 | 13 | function create_main_fragment(component, ctx) { > 14 | var div, slot_content_some-slot = component._slotted["some-slot"], div_class_value; | ^ 15 | 16 | return { 17 | c: function create() { ``` Note the "slot_content_some-slot" variable name, which is invalid. Removing the "-" fixes the issue.
https://github.com/sveltejs/svelte/issues/1461
https://github.com/sveltejs/svelte/pull/1464
36b81b79b26c769f0867f537c3414bea70a3e1dd
83d2251e2667fdff6153fef43c5fec37674861c6
2018-05-14T17:16:55Z
javascript
2018-05-15T12:14:29Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,460
["src/compile/dom/index.ts", "src/compile/nodes/Element.ts", "test/runtime/samples/transition-js-intro-skipped-by-default-nested/Widget.html", "test/runtime/samples/transition-js-intro-skipped-by-default-nested/_config.js", "test/runtime/samples/transition-js-intro-skipped-by-default-nested/main.html"]
Nested components play intros when they shouldn't
Components should inherit the `intro` status of their parents. Currently, [they don't](https://svelte.technology/repl?version=2.6.1&gist=bc219a76f492f6f0ae8a545a863f8e95).
https://github.com/sveltejs/svelte/issues/1460
https://github.com/sveltejs/svelte/pull/1477
cffbd2709c9004acd99acb37993a65728a721986
3f6d0e7b0ea23703178785367ff4271ac62711a0
2018-05-14T15:53:50Z
javascript
2018-05-17T02:03:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,445
["src/parse/state/tag.ts", "test/runtime/samples/attribute-dynamic-reserved/_config.js", "test/runtime/samples/attribute-dynamic-reserved/main.html"]
Reserved keywords cause error when used in an expression with spaces around the keyword
When using reserved JavaScript keywords in an expression, if the expression has spaces in between the curly brackets and the keyword, the parser will throw an error. This throws: `<div class="{ class }"></div>` But this does not: `<div class="{class}"></div>` This goes for all JS keywords. I've tested `import`, `export`, and `class` at least. REPL with failing test case: https://svelte.technology/repl?version=2.5.0&gist=9d4b8a0c733a48397d8a66feb9881fa5 REPL with passing test case: https://svelte.technology/repl?version=2.5.0&gist=6149f93a9af8cbc6286a335b8afbfaec
https://github.com/sveltejs/svelte/issues/1445
https://github.com/sveltejs/svelte/pull/1446
5dd149ef7b92cc84a19386319a2acb8d2aa8d725
57c0fdc6b82e50363bfb84eff796ff1c071ceb50
2018-05-10T22:15:51Z
javascript
2018-05-11T02:03:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,441
["src/utils/globalWhitelist.ts"]
Can't use Promise in template expression
Side-issue to #1440 — you can't use `Promise` in a template expression without declaring it as a helper (or as data). It should be among the whitelisted globals: ```html {#await Promise.resolve(42)} <p>waiting...</p> {:then answer} <p>the answer is {answer}</p> {/await} {#if true} <p>true!</p> {/if} <!-- the script block should be unnecessary --> <script> export default { helpers: { Promise } }; </script> ```
https://github.com/sveltejs/svelte/issues/1441
https://github.com/sveltejs/svelte/pull/1444
05f7d44b246335a61749ae121935c0a19b804083
085926d20f419f665d841cb567223715c6d5a807
2018-05-10T14:29:45Z
javascript
2018-05-10T23:28:35Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,434
["src/compile/nodes/Attribute.ts", "src/compile/render-ssr/handlers/Element.ts", "src/shared/dom.js", "test/runtime/samples/set-undefined-attr/_config.js", "test/runtime/samples/set-undefined-attr/main.html"]
Ignore undefined/falsey properties on components and elements
[Brought up in chat](https://gitter.im/sveltejs/svelte?at=5af04c0400dc4888049f6ac2) by @arxpoetica: when using spread to apply an object's properties to an element, it is desirable to be able to say "apply everything except these specific properties". Say, for example, something like `<svelte:component this={MyComponent} {...all} />`, which would result in a `MyComponent` property being set on the component. If the spread operator ignored falsey values (or more safely, just ignored undefined values) on the object, it would be relatively easy to use something like `Object.assign` to specifically exclude some properties, say with this computed property: ```js computed: { forSpread: all => Object.assign({}, all, { MyComponent: undefined }) } ```
https://github.com/sveltejs/svelte/issues/1434
https://github.com/sveltejs/svelte/pull/1815
ed2a01b069f665352742d9c7a484c3bbef55c7a0
21259a07109a6ce17b02cba6d1a381fc0b0f94f2
2018-05-07T13:05:38Z
javascript
2018-10-28T12:39:58Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,425
["src/compile/dom/Block.ts", "src/compile/nodes/AwaitBlock.ts", "src/compile/nodes/EachBlock.ts", "src/compile/nodes/Element.ts", "src/compile/nodes/IfBlock.ts", "src/shared/transitions.js", "test/runtime/samples/transition-js-aborted-outro-in-each/_config.js", "test/runtime/samples/transition-js-aborted-outro-in-each/main.html", "test/runtime/samples/transition-js-aborted-outro/_config.js", "test/runtime/samples/transition-js-aborted-outro/main.html"]
outro is not aborted
If a block has an outro, and the block is recreated during that outro, the transition isn't aborted — the content is still removed. [REPL](https://svelte.technology/repl?version=2.4.4&gist=ec5210f14bc4d27ce1994e8bc14895fa)
https://github.com/sveltejs/svelte/issues/1425
https://github.com/sveltejs/svelte/pull/1428
e1db82773d13836f4d1746b99398982398fc228e
e8a780676d2a9115bd713eaab783531913cb2cda
2018-05-06T00:54:10Z
javascript
2018-05-06T19:50:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,419
["src/compile/nodes/Element.ts", "test/js/samples/input-range/expected-bundle.js", "test/js/samples/input-range/expected.js", "test/js/samples/input-range/input.html"]
<input type=range bind:value> duplicates handlers unnecessarily
With [this markup](https://svelte.technology/repl?version=2.4.4&gist=cdf74219bd9a8a06d6af6a9d9cf9d888)... ```html <input type=range bind:value> ``` ...Svelte could generate leaner code: ```diff function create_main_fragment(component, ctx) { var input; function input_input_handler() { component.set({ value: toNumber(input.value) }); } - function input_change_handler() { - component.set({ value: toNumber(input.value) }); - } - return { c: function create() { input = createElement("input"); addListener(input, "input", input_input_handler); - addListener(input, "change", input_change_handler); + addListener(input, "change", input_input_handler); setAttribute(input, "type", "range"); }, m: function mount(target, anchor) { insertNode(input, target, anchor); input.value = ctx.value; }, p: function update(changed, ctx) { input.value = ctx.value; input.value = ctx.value; }, u: function unmount() { detachNode(input); }, d: function destroy() { removeListener(input, "input", input_input_handler); - removeListener(input, "change", input_change_handler); + removeListener(input, "change", input_input_handler); } }; } ```
https://github.com/sveltejs/svelte/issues/1419
https://github.com/sveltejs/svelte/pull/1423
dc8b0d6be148ec636ebf9e98947b67740876d5d5
a9464c7ebf208458ecb61f469dc858f0082b0d63
2018-05-05T18:23:28Z
javascript
2018-05-06T00:40:52Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,417
["src/compile/dom/Block.ts", "src/compile/nodes/AwaitBlock.ts", "src/shared/await-block.js", "src/shared/index.js", "src/shared/utils.js", "test/runtime/samples/await-then-catch-static/_config.js", "test/runtime/samples/await-then-catch-static/main.html"]
Await blocks with no dynamic content behave incorrectly
[REPL](https://svelte.technology/repl?version=2.4.4&gist=7a5183c273f433476551b35895189a9a). When you click the button, a new block is created; the old one reverts to its pending state and stays in the DOM. ```html <button on:click='updatePromise()'>click me</button> {#await promise} <p>loading...</p> {:then value} <p>loaded</p> <!-- change this to `loaded {value}` and it works correctly --> {:catch error} <p>errored</p> {/await} <script> export default { data: () => ({ promise: new Promise(f => setTimeout(() => f(42), 1000)) }), methods: { updatePromise() { this.set({ promise: new Promise(f => setTimeout(() => f(99), 1000)) }); } } }; </script> ```
https://github.com/sveltejs/svelte/issues/1417
https://github.com/sveltejs/svelte/pull/1418
9883fb67da84cd30c03c26f5e1c6f0be9bec2bc5
49c594e526156dc4cbafec4035730bcb844b0b0f
2018-05-05T15:39:32Z
javascript
2018-05-05T19:15:42Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,415
["store.js"]
store._set - Uncaught ReferenceError: dirty is not defined
It looks like the variable `dirty` is not declared... ```javascript _set(newState, changed) { const previous = this._state; this._state = assign(assign({}, previous), newState); for (let i = 0; i < this._sortedComputedProperties.length; i += 1) { this._sortedComputedProperties[i].update(this._state, changed); } this.fire('state', { changed, previous, current: this._state }); const dependents = this._dependents.slice(); // guard against mutations for (let i = 0; i < dependents.length; i += 1) { const dependent = dependents[i]; const componentState = {}; dirty = false; for (let j = 0; j < dependent.props.length; j += 1) { const prop = dependent.props[j]; if (prop in changed) { componentState['$' + prop] = this._state[prop]; dirty = true; } } if (dirty) dependent.component.set(componentState); } this.fire('update', { changed, previous, current: this._state }); }, ```
https://github.com/sveltejs/svelte/issues/1415
https://github.com/sveltejs/svelte/pull/1416
7ad374d8c261eea23f2e5025b3940c061affe65e
ae8c3ba60209747a6daf1a6c17a481cc39de666d
2018-05-03T21:33:40Z
javascript
2018-05-04T01:21:23Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,413
["src/compile/nodes/Component.ts", "test/runtime/samples/spread-component-dynamic-undefined/_config.js", "test/runtime/samples/spread-component-dynamic-undefined/main.html"]
Spread props on dynamic components fail if no initial value
Bit of an edge case here... If you have a `<svelte:component>` whose `this` doesn't have a value, and it has spread properties, then any updates will fail because the initial spread 'levels' have not been set. [REPL](https://svelte.technology/repl?version=2.4.3&gist=0a0598faa7f6549248455e3a7ec67007) ```html <button on:click="updateProps()">click me</button> <svelte:component this={undefined} {...props}/> {#if error} <pre>{error.stack}</pre> {/if} <script> export default { data() { return { props: {} }; }, methods: { updateProps() { try { this.set({ props: {} }); } catch (error) { this.set({ error }); } } } }; </script> ``` Interestingly, the `this.set({ error })` in that example *also* fails, because always Svelte tries to recalculate spread levels, even if nothing has changed. Should also get fixed.
https://github.com/sveltejs/svelte/issues/1413
https://github.com/sveltejs/svelte/pull/1414
ae8c3ba60209747a6daf1a6c17a481cc39de666d
2e8b9562d7ba7f9a269b6719bdcc88b73e606ed6
2018-05-03T19:36:39Z
javascript
2018-05-04T01:26:04Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,407
["src/compile/nodes/Element.ts", "test/runtime/samples/refs-no-innerhtml/_config.js", "test/runtime/samples/refs-no-innerhtml/main.html"]
Canvas ref not working in div
Subj, a small modified example from the documentation: https://svelte.technology/repl?version=2.4.2&gist=b06728bb9e129364fe7cd9e514275843 the problem started with 2.2.0 version. This ref just not exist in a component.refs object.
https://github.com/sveltejs/svelte/issues/1407
https://github.com/sveltejs/svelte/pull/1408
a75d5935a3c82f139db134c9f14f85004a2b918f
ea95ae741e2d68e5b894d97ec3eb4b1f1b4518f8
2018-05-03T07:33:36Z
javascript
2018-05-03T14:50:54Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,404
["package.json", "yarn.lock"]
tests aren't running on windows?
[This log](https://ci.appveyor.com/project/Rich-Harris/svelte/build/3128) shows that the tests aren't actually running... they should have failed but didn't. No idea why.
https://github.com/sveltejs/svelte/issues/1404
https://github.com/sveltejs/svelte/pull/1473
5d7dc55fd999a454d065ee5f77b925c691af1fb5
cffbd2709c9004acd99acb37993a65728a721986
2018-05-02T01:53:00Z
javascript
2018-05-17T01:12:16Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,397
["src/compile/nodes/EachBlock.ts", "test/runtime/samples/dev-warning-missing-data-each/_config.js", "test/runtime/samples/dev-warning-missing-data-each/main.html"]
Each block key incorrectly treated as expected data property
https://svelte.technology/repl?version=2.4.1&gist=6650af687dd70e62050e9b0d27e59c03 The keyed each block causes the runtime dev warning `<App> was created without expected data property 'letter'`, which it should not. cc @johnmuhl
https://github.com/sveltejs/svelte/issues/1397
https://github.com/sveltejs/svelte/pull/1402
b64d730a17632fc002a9a3cf9d12153e65887e3b
eff431965e3e02000ab61e55a2ae74a1bd6e15e2
2018-05-01T15:27:02Z
javascript
2018-05-03T01:01:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,394
["src/compile/nodes/Attribute.ts", "src/compile/nodes/Component.ts", "test/js/samples/component-static-array/expected-bundle.js", "test/js/samples/component-static-array/expected.js", "test/js/samples/component-static-array/input.html"]
Literals in props should not be updated
In a case like [this](https://svelte.technology/repl?version=2.4.0&gist=37fdb194fd90bf5e3b19996cc10d5bd2)... ```html <List items='{[1, 2, 3]}'/> ``` ...`items` should never be updated, even if `<List>` had other properties that *were* being updated.
https://github.com/sveltejs/svelte/issues/1394
https://github.com/sveltejs/svelte/pull/1401
6ec21f7a206a9fc46a3c86e3f3ac941556da1863
b64d730a17632fc002a9a3cf9d12153e65887e3b
2018-05-01T01:32:56Z
javascript
2018-05-03T01:00:53Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,390
["src/compile/nodes/EventHandler.ts", "test/runtime/samples/event-handler-each-this/_config.js", "test/runtime/samples/event-handler-each-this/main.html"]
`this` overwritten as component name in arguments of hoisted event handler
See [2.1.1](https://svelte.technology/repl?version=2.1.1&gist=3edebbc9ba03ffeed57bea1c20312113) vs [2.2.0](https://svelte.technology/repl?version=2.2.0&gist=3edebbc9ba03ffeed57bea1c20312113). This _might_ be as simple as wrapping [this](https://github.com/sveltejs/svelte/blob/d010aff9fa468c0feaba390b5c95781e831daf55/src/compile/nodes/EventHandler.ts#L80-L82) in a check for `!this.shouldHoist`, but not sure whether that's the best solution. Maybe we should instead make sure `this.shouldHoist` is false if `this` is one of the arguments to the handler? cc @stalkerg
https://github.com/sveltejs/svelte/issues/1390
https://github.com/sveltejs/svelte/pull/1392
01cdffa46ea3bdf658cbfd999bbdc5698f8640c6
5f471e5e32f8cf0c117ce86852e1273555948313
2018-04-30T17:49:05Z
javascript
2018-05-01T01:36:50Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,369
["src/compile/dom/index.ts", "test/custom-elements/samples/custom-method/main.html", "test/custom-elements/samples/custom-method/test.js", "test/js/samples/action/expected-bundle.js", "test/js/samples/action/expected.js", "test/js/samples/css-shadow-dom-keyframes/expected-bundle.js", "test/js/samples/css-shadow-dom-keyframes/expected.js"]
Custom element missing methods
I've created a basic custom element based on [template-custom-element](https://github.com/sveltejs/template-custom-element) but the component's methods don't seem to being added to the compiled JS. My component ```HTML <h1>Hello {{name}}!</h1> <button on:click="saySomething()">Click me</button> <script> export default { tag: 'my-app', data() { return { 'name': 'World' } }, methods: { saySomething() { alert('Again, please don\'t do this'); } } }; </script> ``` Clicking on the button throws an error: ``` Uncaught TypeError: component.saySomething is not a function at HTMLButtonElement.click_handler (App.html:3) ``` Full example is here: https://github.com/willtj/template-custom-element
https://github.com/sveltejs/svelte/issues/1369
https://github.com/sveltejs/svelte/pull/1375
bf58a20909f1629fec708a4e8d0eca66bbf23b23
ff45a5315f256158378970dd2147d83733aedc3b
2018-04-25T13:12:02Z
javascript
2018-04-29T14:53:07Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,368
["src/Stats.ts", "src/index.ts", "test/stats/index.js", "test/stats/samples/hooks/_config.js"]
Stats object different with generate: false
When running compile with `generate: false`, the stats object returned is a quite different to normal e.g. `generate: false` ```js Stats { startTime: 73029841.411771, stack: [], timings: [ { label: 'parse', start: 73029841.442941, end: 73029845.902759, children: [] }, { label: 'stylesheet', start: 73029845.913745, end: 73029846.028204, children: [] }, { label: 'validate', start: 73029846.034336, end: 73029849.531215, children: [] } ], currentChildren: [ { label: 'parse', start: 73029841.442941, end: 73029845.902759, children: [] }, { label: 'stylesheet', start: 73029845.913745, end: 73029846.028204, children: [] }, { label: 'validate', start: 73029846.034336, end: 73029849.531215, children: [] } ], onwarn: [Function: defaultOnwarn], warnings: [], currentTiming: undefined } ``` and `generate: "dom"` ```js { timings: { total: 18.931489005684853, parse: { total: 4.1629389971494675 }, stylesheet: { total: 0.11548098921775818 }, validate: { total: 3.2378130108118057 }, compile: { total: 11.331197991967201 } }, warnings: [], imports: [ { source: './_components/Layout.html', specifiers: [Array] } ], hooks: {} } ```
https://github.com/sveltejs/svelte/issues/1368
https://github.com/sveltejs/svelte/pull/1374
ff45a5315f256158378970dd2147d83733aedc3b
83af7bb8fd1bbb6b94ec5927e96197e880c3d84e
2018-04-23T14:44:04Z
javascript
2018-04-29T14:53:40Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,356
["src/generators/dom/index.ts", "src/shared/utils.js", "test/js/samples/deconflict-globals/expected-bundle.js", "test/js/samples/deconflict-globals/expected.js", "test/runtime/samples/onstate-no-template/_config.js", "test/runtime/samples/onstate-no-template/main.html"]
onstate: changed is empty if data property not mentioned in template
[REPL](https://svelte.technology/repl?version=2.0.0&gist=b000d1c0362207f646684a88d18d3785) contains just a property `test` and an `onstate` listener. `onstate` fires, but `changed` is empty. If `test` is used in the template, `changed` is `{test: 1}`, as expected.
https://github.com/sveltejs/svelte/issues/1356
https://github.com/sveltejs/svelte/pull/1364
4734382e69ad2bdcc069ca7e53421e9293cf94e2
6534fef37de5bfba8babe80fe0a404ad69a8cd2c
2018-04-20T17:04:40Z
javascript
2018-04-22T18:08:57Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,353
["src/generators/nodes/Component.ts", "test/runtime/samples/component-event-not-stale/Button.html", "test/runtime/samples/component-event-not-stale/_config.js", "test/runtime/samples/component-event-not-stale/main.html"]
Component data not updated when firing an event as a result of an event fired in a nested component.
I have come across an issue when firing a custom event which is triggered as a result of an event fired in a nested component. If you fire the custom event within the components directive, the data seems to be from the initial state of the container component. The value is changed within the nested component though. If you use an event handler in the directive and fire the custom event from within the handler then the container components data is correct. REPL example for a better explanation so ^ makes sense - https://svelte.technology/repl?version=1.64.0&gist=60bdf43e8b114186d23cd85893295748
https://github.com/sveltejs/svelte/issues/1353
https://github.com/sveltejs/svelte/pull/1366
a78f37d0bfae7304865b20c39d20c3f9d26801d3
4f86820cf05d9e8a989c7d5fb0c4393c0c905a20
2018-04-19T02:56:19Z
javascript
2018-04-22T18:08:19Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,349
["src/generators/server-side-rendering/index.ts"]
v2 SSR computed properties: component _render method does not pass ref object
Here is some sample generated code. Notice that `meta__Layout__SSR(...)` does not receive a `ref` object, but the three dependency props instead. ```javascript Page__Company__SSR._render = function (__result, state, options) { __result.addComponent(Page__Company__SSR); state = Object.assign(options.store._init(["summary__company"]), data$3(), state); state.meta__Layout__SSR = meta__Layout__SSR(state.ctx, state.meta, state.company_locator); state.styles__Layout__SSR = styles__Layout__SSR(state.ctx, state.styles); state.scripts__Layout__SSR = scripts__Layout__SSR(state.ctx, state.scripts); state.company_name = company_name$5(state.$summary__company); state.title = title$1(state.ctx, state.company_name); return "" + Layout__SSR._render(__result, { ctx: state.ctx, meta: state.meta__Layout__SSR, styles: state.styles__Layout__SSR, title: state.title, scripts: state.scripts__Layout__SSR, components__load: state.components__load }, { store: options.store, slotted: { default: function () { return "\n " + Page__Company._render(__result, { ctx: state.ctx }, { store: options.store }) + "\n"; } } }); }; ```
https://github.com/sveltejs/svelte/issues/1349
https://github.com/sveltejs/svelte/pull/1350
8e687238aa36ed4e915d4995e6821339a4ab3d24
c9ec1559acf90367c4939c4bf49319df55c0e7c5
2018-04-17T07:33:58Z
javascript
2018-04-18T11:58:05Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,337
["src/generators/nodes/Component.ts", "src/generators/nodes/Element.ts", "src/utils/flattenReference.ts", "test/runtime/samples/spread-each-component/Nested.html", "test/runtime/samples/spread-each-component/_config.js", "test/runtime/samples/spread-each-component/main.html", "test/runtime/samples/spread-each-element/_config.js", "test/runtime/samples/spread-each-element/main.html"]
Each blocks with spread attributes on children not updating
[REPL](https://svelte.technology/repl?version=1.60.3&gist=00df74713efec24d6b0580763e4b0edb). I *think* what's happening here is that it doesn't believe the first each block to be dynamic; it doesn't recognise that there's a dynamic attribute, so it doesn't bother writing update code. [This variant](https://svelte.technology/repl?version=1.60.3&gist=a87f1733d26f66293bcd8c9d6dab4492) works as expected, because it trips the necessary wire.
https://github.com/sveltejs/svelte/issues/1337
https://github.com/sveltejs/svelte/pull/1357
d215279ef115e909d9d72291c6884de70c73b94e
350d1ede6718a5a8311d953d89678c616f82dac4
2018-04-13T21:12:19Z
javascript
2018-04-20T21:28:02Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,327
["store.js", "test/runtime/samples/store-computed-oncreate/_config.js", "test/runtime/samples/store-computed-oncreate/main.html"]
Defining store computed property after it is referenced in a template causes initial value to be undefined
It does not seem like store can be used in the repl (https://github.com/sveltejs/svelte.technology/issues/213), so I'll explain the issue here. I am mixing in computed properties into a store. It does not seem like the initial value of newly created store computed properties bubble up to the template. ```html <p>{{$name}}</p> <script> export default { oncreate() { this.store.compute('name', ['user'], user => user && user.name) this.store.set({user: {name: 'Joe'}}) } } </script> ``` To alleviate this issue, I added a `compute` wrapper: ```javascript export function compute(store, name, deps, fn) { const values__deps = [] for (let i=0; i < deps.length; i++) { values__deps.push(store.get(deps[i])) } const __set = {} __set[name] = fn(...values__deps) store.set(__set) store.compute(name, deps, fn) return store } ```
https://github.com/sveltejs/svelte/issues/1327
https://github.com/sveltejs/svelte/pull/1395
ea95ae741e2d68e5b894d97ec3eb4b1f1b4518f8
bea1265cae2269d23955a4d80bdf7824e81404a0
2018-04-08T07:52:25Z
javascript
2018-05-03T14:51:08Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,307
["src/generators/nodes/Component.ts", "test/runtime/samples/spread-component-dynamic/Foo.html", "test/runtime/samples/spread-component-dynamic/_config.js", "test/runtime/samples/spread-component-dynamic/main.html"]
switch_instance_spread_levels is not defined
[REPL](https://svelte.technology/repl?version=1.60.0&gist=6acdb5552f0aa44dbc55bf9f770e7093). This prevents you from using spread props with `<:Component>`, which is perhaps where they're most useful.
https://github.com/sveltejs/svelte/issues/1307
https://github.com/sveltejs/svelte/pull/1308
db21e80a99ec5103f64cb9578c9f86e60cc59fbf
6266d6fba4517cd1a28994e7b64d5dccd414d0a7
2018-04-03T19:57:18Z
javascript
2018-04-03T20:57:38Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,306
["src/generators/nodes/EachBlock.ts", "src/shared/keyed-each.js", "test/runtime/samples/each-block-keyed-siblings/_config.js", "test/runtime/samples/each-block-keyed-siblings/main.html"]
DOM order is not guaranteed when using keys
If you add a key to an each block, when that updates, the DOM order of the component is no longer guaranteed - maybe it's moving those updates to the end. ``` {{#each ones as one @text}} <div>{{one.text}}</div> {{/each}} {{#each twos as two @text}} <div>{{two.text}}</div> {{/each}} <script> export default { data() return { ones: [{ text: '1' }], twos: [{ text: '2' }], }; }, oncreate() { this.set({ ones: [{ text: '11' }] }); } } </script> ``` If you run this, you'll see that the "ones" are placed after the "twos" once the component is created. REPL: https://svelte.technology/repl?version=1.60.0&gist=e4d16c0723f25a51525fac0b8afd02d8
https://github.com/sveltejs/svelte/issues/1306
https://github.com/sveltejs/svelte/pull/1309
b4ade9d4b2e32657bbc95b4cdbfcd2322a8bdbef
58dba848c76f6c4d3411d49df41cbb66ab976b47
2018-04-03T15:15:19Z
javascript
2018-04-04T10:56:59Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,303
["src/compile/Compiler.ts", "src/compile/dom/index.ts", "src/compile/ssr/index.ts", "src/validate/js/propValidators/computed.ts", "test/runtime/samples/computed-state-object/_config.js", "test/runtime/samples/computed-state-object/main.html"]
"current data object" in templates (re: spread)
Follow-on to #195 - In order to use the spread functionality to pass arbitrary properties that were applied to the current component on to child components, we need to be able to reference the current data/state object in the template. I think `{{...state}}` and `{{...data}}` and `{{...@}}` were tossed around, but my vague impression is that `{{...this}}` is the current top pick.
https://github.com/sveltejs/svelte/issues/1303
https://github.com/sveltejs/svelte/pull/1377
7246997dd57052a265e94c1f0590fcf3947844f0
ddf2d9dbcf1fec4a2516c7e7613366c2feb0b5ac
2018-04-02T14:49:47Z
javascript
2018-04-29T14:52:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,301
["src/generators/nodes/Component.ts"]
Data property is added twice for components
[REPL](https://svelte.technology/repl?version=1.60.0&gist=e0c55cd43e39bcd1fb8b187f3b43c240). This code gets generated: ```js var child = new Child({ root: component.root, data: child_initial_data, data: child_initial_data, _bind: function(changed, childState) { var state = component.get(), newState = {}; if (!child_updating.items && changed.items) { newState.items = childState.items; } component._set(newState); child_updating = {}; } }); ``` Should be a nice easy fix
https://github.com/sveltejs/svelte/issues/1301
https://github.com/sveltejs/svelte/pull/1302
f493dccaa685b11f5254b38c444287645a2a8289
db21e80a99ec5103f64cb9578c9f86e60cc59fbf
2018-04-02T12:31:27Z
javascript
2018-04-03T20:16:56Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,300
["src/css/Selector.ts", "test/css/samples/spread/_config.js", "test/css/samples/spread/expected.css", "test/css/samples/spread/input.html"]
Spread properties cause CSS to be DCE'd incorrectly
[REPL](https://svelte.technology/repl?version=1.60.0&gist=678853cb781d28931abbc159c22d2d7f) ```html <div {{...props}} > Big red Comic Sans </div> <style> .foo { color: red; font-size: 2em; font-family: 'Comic Sans MS'; } </style> ``` `.foo` should be preserved; it isn't.
https://github.com/sveltejs/svelte/issues/1300
https://github.com/sveltejs/svelte/pull/1310
58dba848c76f6c4d3411d49df41cbb66ab976b47
8717ff8c3c4fdb71b1cac0da6173b02bf82af56d
2018-04-01T21:10:19Z
javascript
2018-04-04T10:57:38Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,297
["src/compile/nodes/EventHandler.ts", "src/compile/nodes/shared/Expression.ts", "src/utils/flattenReference.ts", "test/runtime/samples/event-handler-custom-this/_config.js", "test/runtime/samples/event-handler-custom-this/main.html"]
`this` has wrong meaning in custom event handler
In this situation ([REPL](https://svelte.technology/repl?version=1.59.0&gist=08ce28e21758796e9651169507eb6af3))... ```html <p>Select the input, hit 'enter', check the console</p> <input on:enter='this.blur()'> <script> export default { events: { enter(node, callback) { function handleKeydown(event) { if (event.which === 13) callback(); } node.addEventListener('keydown', handleKeydown); return { destroy() { node.removeEventListener('keydown', handleKeydown); } }; } } }; </script> ``` I'd expect `this.blur()` to refer to the `<input>`, but this code is generated: ```js enter_handler = enter.call(component, input, function(event) { this.blur(); }); ``` `this` should probably be rewritten as `input`. Workaround is this: ```diff -if (event.which === 13) callback(); +if (event.which === 13) callback.call(node); ```
https://github.com/sveltejs/svelte/issues/1297
https://github.com/sveltejs/svelte/pull/1376
ddf2d9dbcf1fec4a2516c7e7613366c2feb0b5ac
bf58a20909f1629fec708a4e8d0eca66bbf23b23
2018-03-31T20:31:44Z
javascript
2018-04-29T14:52:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,291
["src/generators/nodes/EachBlock.ts", "test/runtime/samples/each-block-keyed-static/_config.js", "test/runtime/samples/each-block-keyed-static/main.html"]
Keyed each blocks break with static content
[REPL](https://svelte.technology/repl?version=1.58.5&gist=b72943d6863d322b077c61b36a0c19ba). The offending code: ```js each_blocks_1 = updateKeyedEach(each_blocks_1, component, changed, "z",, each_value, each_lookup, each_anchor.parentNode, false, create_each_block, "m", function(i) {...} ```
https://github.com/sveltejs/svelte/issues/1291
https://github.com/sveltejs/svelte/pull/1292
c943a86032605fb5985a01863b54465c2a76fbbf
77aca3c69b8fae2dd68c3e7868afef8b65e79ab7
2018-03-30T19:41:33Z
javascript
2018-03-30T20:01:46Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,290
["src/shared/transitions.js"]
Transition animations are removed prematurely
See https://kaysercommentary.com/Resources/Crucifixion-Resurrection-Timeline.md — if you scroll up and down quickly, transitions get removed before they're finished with. This is the offending commit — https://github.com/sveltejs/svelte/commit/be678c680dea88b933610c6b0edf8b3f005adfeb — it should be based on `name`, not just `__svelte`. This is what happens when I write code without getting enough sleep
https://github.com/sveltejs/svelte/issues/1290
https://github.com/sveltejs/svelte/pull/1293
78f506a50b8aeda6796594db4657334c13bcd160
c943a86032605fb5985a01863b54465c2a76fbbf
2018-03-30T19:02:39Z
javascript
2018-03-30T19:56:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,287
["src/compile/nodes/EachBlock.ts", "src/shared/keyed-each.js", "test/js/samples/deconflict-builtins/expected-bundle.js", "test/js/samples/deconflict-builtins/expected.js", "test/js/samples/each-block-changed-check/expected-bundle.js", "test/js/samples/each-block-changed-check/expected.js"]
Deduplicate each_context generation
```diff function create_main_fragment(component, state) { var each_anchor; var each_value = state.Object.entries(state.things); + + function get_each_context(state, each_value, i) { + return assign(assign({}, state), { + each_value: each_value, + key_value: each_value[i], + key_value_index: i, + key: each_value[i][0], + value: each_value[i][1] + }); + } var each_blocks = []; for (var i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block(component, assign(assign({}, state), { - each_value: each_value, - key_value: each_value[i], - key_value_index: i, - key: each_value[i][0], - value: each_value[i][1] - })); + each_blocks[i] = create_each_block(get_each_context(state, each_value, i)); } return { c: function create() { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } each_anchor = createComment(); }, m: function mount(target, anchor) { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(target, anchor); } insertNode(each_anchor, target, anchor); }, p: function update(changed, state) { var each_value = state.Object.entries(state.things); if (changed.Object || changed.things) { for (var i = 0; i < each_value.length; i += 1) { - var each_context = assign(assign({}, state), { - each_value: each_value, - key_value: each_value[i], - key_value_index: i, - key: each_value[i][0], - value: each_value[i][1] - }); + var each_context = get_each_context(state, each_value, i); if (each_blocks[i]) { each_blocks[i].p(changed, each_context); } else { each_blocks[i] = create_each_block(component, each_context); each_blocks[i].c(); each_blocks[i].m(each_anchor.parentNode, each_anchor); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].u(); each_blocks[i].d(); } each_blocks.length = each_value.length; } }, u: function unmount() { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].u(); } detachNode(each_anchor); }, d: function destroy() { destroyEach(each_blocks); } }; } ``` See also #1187.
https://github.com/sveltejs/svelte/issues/1287
https://github.com/sveltejs/svelte/pull/1384
2c3f846623bee52be6d209931a34fa7a8045a856
dbd5a76a6a436c29100d39206c4c7ede9a14505b
2018-03-28T18:08:19Z
javascript
2018-04-29T20:33:37Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,286
["src/compile/nodes/EachBlock.ts", "test/js/samples/deconflict-builtins/expected-bundle.js", "test/js/samples/deconflict-builtins/expected.js", "test/js/samples/each-block-changed-check/expected-bundle.js", "test/js/samples/each-block-changed-check/expected.js"]
Only recalculate each_value if necessary
Svelte knows that it doesn't need to update each blocks whose dependencies haven't changed. But it isn't smart not to recalculate `each_value`. In [this example](https://svelte.technology/repl?version=1.58.4&gist=04aeba5150c7e3aaa4c7066d61d3c1e6)... ```html {{#each Object.entries(things) as [key, value]}} ({{key}}: {{value}}) {{/each}} <script> export default { data: () => ({ things: { a: 1, b: 2, c: 3 } }) } </script> ``` ...it should generate this code: ```diff p: function update(changed, state) { - var each_value = state.Object.entries(state.things); if (changed.Object || changed.things) { + var each_value = state.Object.entries(state.things); for (var i = 0; i < each_value.length; i += 1) { var each_context = assign(assign({}, state), { each_value: each_value, key_value: each_value[i], key_value_index: i, key: each_value[i][0], value: each_value[i][1] }); if (each_blocks[i]) { each_blocks[i].p(changed, each_context); } else { each_blocks[i] = create_each_block(component, each_context); each_blocks[i].c(); each_blocks[i].m(each_anchor.parentNode, each_anchor); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].u(); each_blocks[i].d(); } each_blocks.length = each_value.length; } }, ```
https://github.com/sveltejs/svelte/issues/1286
https://github.com/sveltejs/svelte/pull/1378
d8ca0e39a3a59c01b51a851f9b37aa781f97c418
7246997dd57052a265e94c1f0590fcf3947844f0
2018-03-28T17:59:22Z
javascript
2018-04-29T14:52:00Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,278
["src/generators/nodes/Component.ts", "test/runtime/samples/component-events-console/Widget.html", "test/runtime/samples/component-events-console/_config.js", "test/runtime/samples/component-events-console/main.html"]
console.log unreachable when used in a component event
ERROR: type should be string, got "https://svelte.technology/repl?version=1.58.0&gist=09304b4620a1c31a3387457ca53b795f\r\n\r\n```html\r\n<svg viewBox='0 0 1000 1000' style='width: 100%; height: 100%;'>\r\n {{#each icons as icon}}\r\n <Icon x=\"{{icon.x}}\" y=\"{{icon.y}}\" z=\"{{icon.size}}\" fill=\"{{icon.fill}}\" icon=\"{{icon.i}}\" \r\non:drg='console.log(icon)'/> {{/each}}\r\n----------^^^^^^^^^^\r\n...\r\n```\r\n> To make it fail you should click on an icon in the output window\r\n\r\n\r\n<details>\r\n <summary>Stack trace Chrome</summary>\r\n\r\nUncaught TypeError: Cannot read property 'log' of undefined\r\n at Icon.eval (eval at createComponent (repl.0.js:1), <anonymous>:211:22)\r\n at Icon.c [as fire] (shared.js:1)\r\n at SVGGElement.click_handler (eval at createComponent (repl.0.js:1), <anonymous>:29:14)\r\n</details>\r\n<details>\r\n\r\n<summary>Stack trace Firefox</summary>\r\n\r\nTypeError: component.console is undefined\r\n...\r\n</details>\r\n\r\n\r\nCurrent proposed work arround is shown here: https://svelte.technology/repl?version=1.58.0&gist=9b0a4442260d58bc1136c8d3c0669d59\r\n\r\n"
https://github.com/sveltejs/svelte/issues/1278
https://github.com/sveltejs/svelte/pull/1311
4a6807eab1e8a8e51e1b0de767882327d578d42b
07a53e55de749482517fdd969d4e396022aecdcb
2018-03-26T13:23:00Z
javascript
2018-04-04T14:38:02Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,277
["src/compiler/compile/css/Selector.ts", "src/compiler/compile/css/Stylesheet.ts", "test/css/samples/preserve-specificity/expected.css", "test/css/samples/preserve-specificity/expected.html", "test/css/samples/preserve-specificity/input.svelte", "test/js/samples/collapses-text-around-comments/expected.js", "test/js/samples/css-media-query/expected.js"]
Encapsulated CSS specificity bug
This is possibly a bit of an edge case, and it's something that can easily be worked around, but it's a bug nonetheless: https://gist.github.com/giuseppeg/d37644d8d9d5004b15c5c48e66f632aa ```html <div> <div> <div> <span> Big red Comic Sans </span> <span class='foo'> Big red Comic Sans </span> </div> </div> </div> <style> div div div span { color: red; font-size: 2em; font-family: 'Comic Sans MS'; } .foo { color: green; } </style> ``` In this example, the second span should be green (because classes override element selectors), but because Svelte transforms it to... ```html <style> div.svelte-xyz div div span.svelte-xyz { color: red; font-size: 2em; font-family: 'Comic Sans MS'; } .foo.svelte-xyz { color: green; } </style> ``` ...the first declaration defeats the second one. One possible solution is to double up single selectors: ```css .foo.svelte-xyz.svelte-xyz { color: green; } ``` See https://github.com/thysultan/stylis.js/issues/101. Thanks to @giuseppeg for flagging this up
https://github.com/sveltejs/svelte/issues/1277
https://github.com/sveltejs/svelte/pull/4146
140bfd0ce2fb8be09157ea12d93b63848852b714
c0dab9fefb9fd44e3311ab6e56ef168b156fe799
2018-03-26T11:33:56Z
javascript
2019-12-23T19:21:29Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,275
["src/generators/Generator.ts", "src/generators/dom/Block.ts", "src/generators/dom/index.ts", "test/runtime/samples/component-name-deconflicted/Nested.html", "test/runtime/samples/component-name-deconflicted/_config.js", "test/runtime/samples/component-name-deconflicted/main.html"]
If in #each block naming collision
Stuff broke after 1.55.1 for me, I got naming collisions in this case: ```html {{#each list as nested}} {{#if true}} <Nested :nested/> {{/if}} {{/each}} <script> import Nested from './Nested.html'; export default { data: () => ({ list: [1,2] }), components: { Nested } }; </script> ``` The output in 1.58.2 is: ```javascript // (2:2) {{#if true}} function create_if_block(component, state) { var nested = state.nested, each_value = state.each_value, nested_index = state.nested_index; var nested = new Nested({ root: component.root, data: { nested: nested } }); return { c: function create() { nested._fragment.c(); }, m: function mount(target, anchor) { nested._mount(target, anchor); }, p: function update(changed, state) { nested = state.nested; each_value = state.each_value; nested_index = state.nested_index; var nested_changes = {}; if (changed.list) nested_changes.nested = nested; nested._set(nested_changes); }, u: function unmount() { nested._unmount(); }, d: function destroy() { nested.destroy(false); } }; } ```
https://github.com/sveltejs/svelte/issues/1275
https://github.com/sveltejs/svelte/pull/1312
f66f21bf23634be04e677fcf010a5a6abfd5511f
4a6807eab1e8a8e51e1b0de767882327d578d42b
2018-03-25T16:42:48Z
javascript
2018-04-04T14:37:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,270
["package-lock.json"]
Two-way binding select does not allow for dynamic multiple attribute
The two-way binding on multiple select elements don't take a dynamically set `multiple`-attribute into consideration. Maybe this is as intended, in which case it appears to be missing from the documentation (or I simply overlooked it). A [simple REPL](https://svelte.technology/repl?version=1.58.0&gist=31327ce7186cb451811813a5b832b255) to demonstrate the behavior. Short examples: - Works: `<select bind:value multiple>` - Doesn't: `<select bind:value :multiple>` - Doesn't:`<select bind:value multiple="{{ multiple }}">` As for browsers, the behavior is consistent across browsers, tested in Firefox 60, Brave 0.21, Electron 1.8.3 (Chromium 59)
https://github.com/sveltejs/svelte/issues/1270
https://github.com/sveltejs/svelte/pull/7248
a4a1c3c27293fe4993e81eaf24cf6fa030a9aacb
5c256bffd14a463873677ab3e1c2c28460ee56f5
2018-03-22T07:16:53Z
javascript
2022-02-13T04:28:25Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,269
["src/css/Selector.ts", "test/css/samples/omit-scoping-element-uppercase/_config.js", "test/css/samples/omit-scoping-element-uppercase/expected.css", "test/css/samples/omit-scoping-element-uppercase/expected.html", "test/css/samples/omit-scoping-element-uppercase/input.html"]
Capitalization throws off CSS scoping
If you put this in REPL: ``` <h1> Big red Comic Sans </h1> <H1> Big red Comic Sans </H1> <style> h1 { color: red; font-size: 2em; font-family: 'Comic Sans MS'; } </style> ``` You'll see one of the H1s is styled the other is not. Element names are not case sensitive in CSS, so both elements should be styled. See this codepen for non-svelte HTML result: https://codepen.io/teleclimber/pen/GxmvGJ Thanks!
https://github.com/sveltejs/svelte/issues/1269
https://github.com/sveltejs/svelte/pull/1314
84019b5cea00a8cb9bf1e79ee0e0f3c64d1a4098
2cd495739f18925a300c541395a2067ca5223902
2018-03-22T01:46:33Z
javascript
2018-04-04T14:34:53Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,268
["src/generators/nodes/Window.ts", "src/validate/html/validateWindow.ts", "test/runtime/samples/window-event-custom/_config.js", "test/runtime/samples/window-event-custom/main.html"]
Custom events not working on <:Window>
Custom events are not being respected (used) when listening to them on `<:Window>`. The repl wasn't saving for me just now so you can copy-paste this into it to see. It gives an error about the `escKey` custom event being unused and in the source you can see it has `window.addEventListener('escKey', onwindowescKey)`. ```html <:Window on:escKey="handleEsc(event)"/> <script> export default { events: { escKey(node, callback) { function onKeyDown(event) { if (event.keyCode === 27) callback(event); } node.addEventListener('keydown', onKeyDown); return { teardown() { node.removeEventListener('keydown', onKeyDown); } } } }, methods: { handleEsc(event) { console.log(event) }, } } </script> ```
https://github.com/sveltejs/svelte/issues/1268
https://github.com/sveltejs/svelte/pull/1315
8717ff8c3c4fdb71b1cac0da6173b02bf82af56d
84019b5cea00a8cb9bf1e79ee0e0f3c64d1a4098
2018-03-22T01:33:04Z
javascript
2018-04-04T14:34:32Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,251
["src/compile/nodes/AwaitBlock.ts", "test/runtime/samples/await-in-each/_config.js", "test/runtime/samples/await-in-each/main.html"]
`await` loses access to outer `each` variable
```html {{#each items as item}} {{#await item.data}} <p>{{item.title}}: Loading...</p> {{then result}} <p>{{item.title}}: {{result}}</p> {{/await}} {{/each}} <script> export default { data() { return { items: [{ title: 'Some data', data: Promise.resolve('this will never show up'), }, { title: 'Some other data', data: Promise.resolve('this will never show up'), }] } } } </script> ``` ``` > TypeError: Cannot read property 'title' of undefined ``` [REPL](https://svelte.technology/repl?version=1.57.4&gist=be67adba829ee3d0ec569f2279820581)
https://github.com/sveltejs/svelte/issues/1251
https://github.com/sveltejs/svelte/pull/1379
ed605bfa790f5989bca5241adddcb30367a8c70b
d8ca0e39a3a59c01b51a851f9b37aa781f97c418
2018-03-17T12:40:32Z
javascript
2018-04-29T14:51:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,233
["src/compiler/compile/render_dom/wrappers/Element/Binding.ts", "src/runtime/internal/dom.ts", "test/js/samples/input-no-initial-value/expected.js", "test/js/samples/input-no-initial-value/input.svelte", "test/js/samples/input-range/expected.js"]
Initial Data for Bound Required Input Fields is 'undefined'
I believe this is a bug, but it may be a request for more documentation. Apologies if I'm posting this in the wrong spot. Two-way binding an input field causes browsers to display the text `'undefined'`. In the [Two-Way Binding](https://svelte.technology/guide#two-way-binding) section of the documentation, readers are provided [an example of form handling in Svelte in the REPL](https://svelte.technology/repl?version=1.57.3&data=eyJnaXN0IjpudWxsLCJjb21wb25lbnRzIjpbeyJuYW1lIjoiQXBwIiwic291cmNlIjoiPGZvcm0gb246c3VibWl0PSdoYW5kbGVTdWJtaXQoIGV2ZW50ICknPlxuXHQ8aW5wdXQgYmluZDp2YWx1ZT0ndGVzdCcgdHlwZT0ndGV4dCc%2BXG5cdDxidXR0b24gdHlwZT0nc3VibWl0Jz5TdG9yZTwvYnV0dG9uPlxuPC9mb3JtPlxuXG48c2NyaXB0PlxuZXhwb3J0IGRlZmF1bHQge1xuXHRtZXRob2RzOiB7XG5cdFx0aGFuZGxlU3VibWl0KGV2ZW50KSB7XG5cdFx0XHQvLyBwcmV2ZW50IHRoZSBwYWdlIGZyb20gcmVsb2FkaW5nXG5cdFx0XHRldmVudC5wcmV2ZW50RGVmYXVsdCgpO1xuXG5cdFx0XHR2YXIgdmFsdWUgPSB0aGlzLmdldCgndGVzdCcpO1xuXHRcdFx0Y29uc29sZS5sb2coJ3ZhbHVlJywgdmFsdWUpO1xuXHRcdH1cblx0fVxufTtcbjwvc2NyaXB0PlxuIn1dLCJkYXRhIjp7fX0%3D). In the example, the input field's initial value is `'undefined'`. I sought to work around the problem by providing default data (in this case, an empty string). Unfortunately, this causes a different problem: Firefox sets input fields to the `:invalid` style state when JavaScript sets the value to `''` on required field, or if the string does not validate (such as with `type="email"`). You can see this [in this REPL (you will need to use Firefox to see the error)](https://svelte.technology/repl?version=1.57.2&gist=a66e8c1a0609ee57bd44202865103006). I believe this is a bug: I expect an undefined variable in a two-way binding scenario not to write `'undefined'` to the field it is found to. Using default data is not desirable because of Firefox's behavior (leads to surprising UX). Workarounds involve losing HTML5 attributes (`required` and `type="email"`) or else avoiding the two-way binding, both of which require more work on the part of the developer using Svelte.
https://github.com/sveltejs/svelte/issues/1233
https://github.com/sveltejs/svelte/pull/3430
ee1fa87c7568c447e0a3bde0c91cc2e0b8240593
e5e41c7333e07d754ad55bed3391be71e3422782
2018-03-13T19:05:08Z
javascript
2019-08-20T12:24:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,229
["src/generators/dom/Block.ts", "src/generators/nodes/EachBlock.ts", "test/js/samples/deconflict-builtins/expected-bundle.js", "test/js/samples/deconflict-builtins/expected.js", "test/js/samples/deconflict-builtins/input.html"]
Context variable overrides shared helper when `hydratable: true`
It seems having keys with the same name as shared helpers can cause problems in v1.57 SSR. eg. This runs fine on the repl, but will error when SSRing because `claim` will try to call `children`: https://svelte.technology/repl?version=1.57.0&gist=9a26ffaad3e8741640d51c55c1600ead ```js // (1:0) {{#if children}} function create_if_block(component, state) { var ul; var children = state.children; var each_blocks = []; for (var i = 0; i < children.length; i += 1) { each_blocks[i] = create_each_block(component, assign({}, state, { children: children, child: children[i], child_index: i })); } return { c: function create() { ul = createElement("ul"); for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } }, l: function claim(nodes) { ul = claimElement(nodes, "UL", {}, false); var ul_nodes = children(ul); // <- children is not a function for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].l(ul_nodes); } ul_nodes.forEach(detachNode); }, ```
https://github.com/sveltejs/svelte/issues/1229
https://github.com/sveltejs/svelte/pull/1231
0ac77019d0bbde3c626f5da36a8637cffa7788f9
475ccdc23f432ada951c77bdc38b6dd296ed8506
2018-03-12T19:33:47Z
javascript
2018-03-15T13:02:00Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,224
["src/generators/nodes/Attribute.ts", "src/generators/nodes/Element.ts", "src/server-side-rendering/register.js", "test/runtime/samples/svg-with-style/_config.js", "test/runtime/samples/svg-with-style/main.html", "test/server-side-rendering/index.js"]
.className can't be used to set classes on SVG elements
Via https://github.com/sveltejs/svelte.technology/issues/216 As of Svelte 1.57.0 we are using classes to scope styles instead of attributes, and SVG DOM elements do not implement a `className` setter, so trying to set that throws an exception. Classes _are_ allowed on SVG elements, but they can't be programmatically set that way. I see that when classes are used on SVG elements normally, the generated code uses `setAttribute`, and so we should probably make sure we use that for CSS scope classes as well. I'm not sure why this didn't show up in unit tests. Either there aren't any unit tests have scoped CSS and SVG or (more worrisome) jsdom erroneously supports .className setting on SVG elements.
https://github.com/sveltejs/svelte/issues/1224
https://github.com/sveltejs/svelte/pull/1226
d9136d97aef3d94322ad50820da42dd5e4e73658
26c5982d8548a2798709a4f8c8130d640522df58
2018-03-10T22:34:49Z
javascript
2018-03-12T14:41:31Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,223
["src/generators/nodes/Element.ts", "test/css/samples/cascade-false-nested/_config.js", "test/css/samples/cascade-false-nested/expected.css", "test/css/samples/cascade-false-nested/expected.html", "test/css/samples/cascade-false-nested/input.html"]
CSS - Class not applied to child elements
> Linux Mint 18.3 Cinnamon > Google Chrome Version 65.0.3325.146 (Official Build) (64-bit) > Firefox Quantum 58.0.2 (64-bit) > svelte: ^1.57.1 [Svelte REPL gist](https://svelte.technology/repl?version=1.57.1&gist=64afb258047bba01ced7946648335bd5) ```html <!-- DevTools Inspector --> <div class="cl1 svelte-1rs9q0o"> Test <div class="cl2">Test 2</div> <!-- class svelte-1rs9q0o missing from element, if added in DevTools it works --> </div> ``` If I add `{{anyTag}}` inside any `div`, regardless of the depth, then `svelte-1rs9q0o` is present and styles are applied. I've tried with depth of 3 and 4. Same behavior.
https://github.com/sveltejs/svelte/issues/1223
https://github.com/sveltejs/svelte/pull/1227
dc4fdcf77e6156da9579c03d83668f86b5a54c1a
eae98f952dff8d908cb77ec9c5f54f7802e5008d
2018-03-10T03:17:12Z
javascript
2018-03-12T15:25:11Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,221
["src/shared/transitions.js", "test/runtime/samples/transition-css-duration/_config.js", "test/runtime/samples/transition-css-duration/main.html"]
Transitions not cancelled
Haven't fully diagnosed this but it seems maybe the transition manager is behaving as though the initial transition were still in play: * https://svelte.technology/repl?version=1.55.0&gist=8411165d371374aab0ed259edf1c954e * https://svelte.technology/repl?version=1.57.1&gist=51c62c40f99041f36f13816049890f94
https://github.com/sveltejs/svelte/issues/1221
https://github.com/sveltejs/svelte/pull/1239
475ccdc23f432ada951c77bdc38b6dd296ed8506
d893eef51348a2278efa26f9d168961c16727a9b
2018-03-09T13:34:02Z
javascript
2018-03-15T13:02:14Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,213
["src/generators/dom/Block.ts", "test/runtime/samples/deconflict-component-refs/_config.js", "test/runtime/samples/deconflict-component-refs/main.html"]
can't use `component` as a context name
Eek, I really caused some damage with #1173: https://svelte.technology/repl?version=1.56.2&gist=a3cf9f2071401f3d6ee7a92e049b8d97 The line `var component = state.component` unsurprisingly breaks everything. This is the root cause of https://github.com/sveltejs/svelte.technology/issues/214.
https://github.com/sveltejs/svelte/issues/1213
https://github.com/sveltejs/svelte/pull/1216
c45b18a387f6e20b26c4630cbef7f5d7812c9395
a49c4faf4a1c64d40c5623405773f75a57c9c5b3
2018-03-07T04:38:34Z
javascript
2018-03-07T15:06:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,209
["src/generators/nodes/Attribute.ts", "test/js/samples/input-without-blowback-guard/expected-bundle.js", "test/js/samples/input-without-blowback-guard/expected.js"]
Input types in IE
The way Svelte creates inputs that are not supported in IE throws an 'Invalid argument' error. Example: https://svelte.technology/repl?version=1.56.2&gist=fa8724f2cbebbcf391e3184b0bc5c39c I have a hard time finding some good docs on this, but here are some similar issues: https://github.com/emberjs/ember.js/issues/10458 https://github.com/angular/angular/issues/16575 I have seen this in IE11 but have not checked other versions of IE. What I have found is that the method Svelte uses to set the type throws an error: ``` input.type = 'date'; ``` But, if you use the `setAttribute`, that seems to work. For instance, my workaround is this: ``` oncreate: function() { if (this.get('isIE')) { this.refs.dateInput.setAttribute('type', 'date'); } } ``` Note that though IE doesn't support the date type, there are polyfills/shims that will work around it, hence the need to have the attribute correct. I am not sure the repercussions of switching to `setAttribute`, but I am not necessarily convinced that this is a problem Svelte needs to solve.
https://github.com/sveltejs/svelte/issues/1209
https://github.com/sveltejs/svelte/pull/1237
d893eef51348a2278efa26f9d168961c16727a9b
26239463c5518622a9473c84f671fa2b51816045
2018-03-06T15:59:10Z
javascript
2018-03-15T13:02:29Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,206
["src/generators/nodes/EachBlock.ts", "test/js/samples/each-block-changed-check/expected-bundle.js", "test/js/samples/each-block-changed-check/expected.js", "test/runtime/samples/each-block-array-literal/_config.js", "test/runtime/samples/each-block-array-literal/main.html"]
Another 1.56 context bug
Via [StackOverflow](https://stackoverflow.com/questions/49119171/event-computed-property-issue/49120647#49120647): ```html <p><input bind:value=search></p> {{#each categories.filter(predicate) as category}} <!-- the click event should work, right? --> <button on:click='console.log(category)'>{{category}}</button> {{/each}} <script> export default { data() { return { search: '', categories: [ 'animal', 'vegetable', 'mineral' ] } }, computed: { predicate: search => { search = search.toLowerCase(); return word => word.startsWith(search); } } }; </script> ``` [REPL](https://svelte.technology/repl?version=1.56.1&gist=798be31e79dfbf363a9f7e497557acfb).
https://github.com/sveltejs/svelte/issues/1206
https://github.com/sveltejs/svelte/pull/1220
89c830ebe7bdb2a198e8f2df0ba915d731629ec0
e34b913a1909bb880b57b15b5b2fe675e3dcf5b1
2018-03-05T22:38:25Z
javascript
2018-03-09T03:15:05Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,195
["src/generators/nodes/IfBlock.ts", "test/js/samples/if-block-no-update/expected-bundle.js", "test/js/samples/if-block-no-update/expected.js", "test/runtime/samples/if-block-else-in-each/_config.js", "test/runtime/samples/if-block-else-in-each/main.html"]
bug with select_block_type function
We have code wich work perfect in 1.54.1 version. But in 1.56 this code not working. Exampes: - [54.1](https://svelte.technology/repl?version=1.54.1&gist=c5fefd4ac9568c773a668237108ad8c1) - [56](https://svelte.technology/repl?version=1.56.0&gist=c5fefd4ac9568c773a668237108ad8c1) function select_block_type in new version not get `header` argument ```javascript function select_block_type(state) { if (!header.icon) return create_if_block_2; return create_if_block_3; } ```
https://github.com/sveltejs/svelte/issues/1195
https://github.com/sveltejs/svelte/pull/1199
8aaf92aca282a81475964a6460de3f1ed46159f6
da165be1bf85041610546e332969b21a1928e6b3
2018-02-26T14:12:23Z
javascript
2018-03-05T11:53:46Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,187
["src/generators/nodes/EachBlock.ts", "test/js/samples/each-block-changed-check/expected-bundle.js", "test/js/samples/each-block-changed-check/expected.js", "test/runtime/samples/each-block-array-literal/_config.js", "test/runtime/samples/each-block-array-literal/main.html"]
Remove references to unused properties
Post-#1122 cleanup: ```html {{#each things as thing}} <p>{{thing}}</p> {{#if true}} <p>thing is unused</p> {{/if}} {{/each}} ``` ```diff function create_main_fragment(component, state) { var each_anchor; var things = state.things; var each_blocks = []; for (var i = 0; i < things.length; i += 1) { each_blocks[i] = create_each_block(component, assign({}, state, { - thing: things[i], - thing_index: i + thing: things[i] })); } return { c: function create() { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } each_anchor = createComment(); }, m: function mount(target, anchor) { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].m(target, anchor); } insertNode(each_anchor, target, anchor); }, p: function update(changed, state) { var things = state.things; if (changed.things) { for (var i = 0; i < things.length; i += 1) { var each_context = assign({}, state, { - thing: things[i], - thing_index: i + thing: things[i] }); if (each_blocks[i]) { each_blocks[i].p(changed, each_context); } else { each_blocks[i] = create_each_block(component, each_context); each_blocks[i].c(); each_blocks[i].m(each_anchor.parentNode, each_anchor); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].u(); each_blocks[i].d(); } each_blocks.length = things.length; } }, u: function unmount() { for (var i = 0; i < each_blocks.length; i += 1) { each_blocks[i].u(); } detachNode(each_anchor); }, d: function destroy() { destroyEach(each_blocks); } }; } // (1:0) {{#each things as thing}} function create_each_block(component, state) { - var thing = state.thing, thing_index = state.thing_index; + var thing = state.thing; var p, text_value = thing, text, text_1, if_block_anchor; var if_block = (true) && create_if_block(component, state); return { c: function create() { p = createElement("p"); text = createText(text_value); text_1 = createText("\n\n\t"); if (if_block) if_block.c(); if_block_anchor = createComment(); }, m: function mount(target, anchor) { insertNode(p, target, anchor); appendNode(text, p); insertNode(text_1, target, anchor); if (if_block) if_block.m(target, anchor); insertNode(if_block_anchor, target, anchor); }, p: function update(changed, state) { thing = state.thing; - thing_index = state.thing_index; if ((changed.things) && text_value !== (text_value = thing)) { text.data = text_value; } if (true) { if (!if_block) { if_block = create_if_block(component, state); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { if_block.u(); if_block.d(); if_block = null; } }, u: function unmount() { detachNode(p); detachNode(text_1); if (if_block) if_block.u(); detachNode(if_block_anchor); }, d: function destroy() { if (if_block) if_block.d(); } }; } // (4:1) {{#if true}} function create_if_block(component, state) { - var thing = state.thing, thing_index = state.thing_index; + var thing = state.thing; var p; return { c: function create() { p = createElement("p"); p.textContent = "thing is unused"; }, m: function mount(target, anchor) { insertNode(p, target, anchor); }, - p: function update(changed, state) { - thing = state.thing; - thing_index = state.thing_index; - - }, + p: noop, u: function unmount() { detachNode(p); }, d: noop }; } ```
https://github.com/sveltejs/svelte/issues/1187
https://github.com/sveltejs/svelte/pull/1220
89c830ebe7bdb2a198e8f2df0ba915d731629ec0
e34b913a1909bb880b57b15b5b2fe675e3dcf5b1
2018-02-24T18:59:16Z
javascript
2018-03-09T03:15:05Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,181
["src/shared/index.js", "test/js/samples/legacy-default/expected-bundle.js", "test/js/samples/legacy-default/expected.js", "test/runtime/samples/store-observe-dollar/_config.js", "test/runtime/samples/store-observe-dollar/main.html"]
Could store.observer be automatically cancelled on component destruction?
When destroying a component, observers observing component state get cancelled automatically while observers on store stay alive. ``` oncreate() { this.observe(... // Gets cancelled this.store.observe(... // Stays alive ``` This came as a surprise to me, with a bit of foot-gun potential. Would it make sense to autocancel store-observers, too? Here is a slightly contrived [REPL](https://svelte.technology/repl?version=1.55.0&gist=0d298cd520af1a6b384b5e194e6c7fd6). Nested.html has observers spammig the console. The store.observer keeps logging after pressing the button.
https://github.com/sveltejs/svelte/issues/1181
https://github.com/sveltejs/svelte/pull/1186
805c72fefc016221bcf7b79c975eca3ae038c3f9
a80104374b43598ecaee30dbf83e18168b3d905d
2018-02-21T07:51:20Z
javascript
2018-02-24T18:30:22Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,177
["store.js", "test/store/index.js"]
store.onchange.cancel() function not scoped correctly.
When attempting to cancel the onchange event listener on my svelte store. ``` let handler = store.onchange(storeChanged); handler.cancel(); ``` I kept receiving the following error: `TypeError: this._changeHandlers is undefined` This is due to the scope of the returned object which contains the cancel() function not having a reference to the changeHandlers array. The workaround in code that I did for this was the following, which I suspect is not what you want the user to have to do. `handler.cancel.bind(store)()` I've written a pull request to fix this, which binds the cancel() function to this, in order to maintain the reference to this._changeHandlers. ``` return { cancel: function() { var index = this._changeHandlers.indexOf(callback); if (~index) this._changeHandlers.splice(index, 1); }.bind(this) }; ```
https://github.com/sveltejs/svelte/issues/1177
https://github.com/sveltejs/svelte/pull/1178
72a65c48da7af38e7e5c01e756c563b4af44c024
fba8a9479bfbc485680de79d46b48b73e9debc16
2018-02-16T10:17:35Z
javascript
2018-02-23T13:50:55Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,166
["src/generators/nodes/Component.ts", "src/generators/nodes/Slot.ts", "test/js/samples/legacy-default/_config.js", "test/js/samples/legacy-default/expected-bundle.js", "test/js/samples/legacy-default/expected.js", "test/js/samples/legacy-default/input.html"]
Output ['default'] instead of .default
Things like `slots.default` don't work in Lynx and Mosaic 😀 We need to use `slots['default']` instead. Via https://github.com/sveltejs/svelte/pull/1159
https://github.com/sveltejs/svelte/issues/1166
https://github.com/sveltejs/svelte/pull/1169
fba8a9479bfbc485680de79d46b48b73e9debc16
4ccc2ade2f827dd9d8c8676b6df785b4f52a475a
2018-02-09T13:29:43Z
javascript
2018-02-23T13:59:39Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,144
["src/generators/nodes/Slot.ts", "test/runtime/samples/component-slot-dynamic/Nested.html", "test/runtime/samples/component-slot-dynamic/_config.js", "test/runtime/samples/component-slot-dynamic/main.html"]
`text is undefined` error with hydrated slotted component with default slot contents using bound computed properties
The setup is as convoluted as the title suggests, ha. I'm trying to do something pretty stupid, so I'm not exactly surprised that things break, but I found it interesting it seems to happen only when all of these conditions are met. Essentially, I'm trying to duplicate Vue's [scoped slots](https://vuejs.org/v2/guide/components.html#Scoped-Slots) using a bound property. The parent renders a slotted component, passing in data and receiving some transformed data back using a bound property. The slotted component has some default content which is being overridden from the parent, but both contents are rendered using the same computed value. This all works in a normal component, but it breaks when the component is hydrated after being server rendered. As such, if using Sapper you navigate to the page, everything works, but if you reload the page it breaks. Additionally, if the slotted child doesn't have any default content, everything works fine as well. [Repro repo](https://github.com/jacobmischka/svelte-hydrate-slot) ![peek 2018-02-01 22-48](https://user-images.githubusercontent.com/3939997/35716994-05d2b5fc-07a2-11e8-851f-f9ec77bbc0ff.gif) (That HMR error is unrelated, the same thing happens when running in production mode). Parent: ```html <Layout page='about'> <Slotted num="{{num}}" bind:computedNum="computedNum"> <p style="color: red;"> {{computedNum}} </p> </Slotted> </Layout> <script> import Layout from './_components/Layout.html'; import Slotted from './_components/Slotted.html'; export default { data() { return { num: 1 }; }, components: { Layout, Slotted } }; </script> ``` Slotted child: ```html <select bind:value="someState"> <option>a</option> <option>b</option> <option>c</option> </select> <slot> <span>{{computedNum}}</span> </slot> {{someState}} <script> export default { data() { return { someState: 'a' }; }, computed: { computedNum(num, someState) { if (!num) return; return `${someState}:${num}`; } } }; </script> ``` Thanks!
https://github.com/sveltejs/svelte/issues/1144
https://github.com/sveltejs/svelte/pull/1185
a80104374b43598ecaee30dbf83e18168b3d905d
aacd14d49963b92750f4443cd79ac70316e09dac
2018-02-02T04:53:33Z
javascript
2018-02-24T18:37:11Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,143
["src/generators/nodes/Attribute.ts", "src/generators/nodes/Binding.ts", "src/generators/nodes/Element.ts", "src/validate/html/validateElement.ts", "test/js/samples/media-bindings/expected-bundle.js", "test/js/samples/media-bindings/expected.js", "test/js/samples/media-bindings/input.html", "test/runtime/samples/binding-audio-currenttime-duration-volume/_config.js", "test/runtime/samples/binding-audio-currenttime-duration-volume/main.html", "test/runtime/samples/binding-audio-currenttime-duration/main.html"]
HTML <audio> volume attribute
I know that `volume` is not one of the documented bind properties for `<audio>`, but I'm surprised that setting the attribute doesn't work at all. This can be worked around with refs, but it would be handy if svelte did that for us when changing `volume`. ```html <audio src="{{src}}" volume="{{volume}} /> ``` I imagine this shouldn't be terribly difficult, I'll try to look at this as soon as I find the time. Thank you!
https://github.com/sveltejs/svelte/issues/1143
https://github.com/sveltejs/svelte/pull/1148
56e9343294d4a83806ab4640c6f4df968a258353
b5a3e2224d4f79211bc2f66fe12e4b6b0e52108c
2018-01-31T19:09:50Z
javascript
2018-02-03T18:33:27Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,139
["src/generators/Generator.ts", "test/runtime/samples/event-handler-custom-each-destructured/_config.js", "test/runtime/samples/event-handler-custom-each-destructured/main.html"]
{{#each}} destructuring references not hoisted correctly
https://svelte.technology/repl?version=1.52.0&gist=c09e6f7dfc81fa6c65c75952b1d103f3 (Ignore the missing method being called in the event handler, that's not part of this issue.) The click event handler is: ```javascript function click_handler(event) { var component = this._svelte.component; component.toggleTag(tag_count[0]); } ``` It's getting hoisted, but the `tag_count` variable (the array containing a `tag` and a `count` that is to be destructured) isn't defined here. cc @funkybob
https://github.com/sveltejs/svelte/issues/1139
https://github.com/sveltejs/svelte/pull/1145
b5a3e2224d4f79211bc2f66fe12e4b6b0e52108c
ca779a452d5fc841de9f51ce7ead58b6318679ff
2018-01-28T00:26:12Z
javascript
2018-02-03T18:37:04Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,138
["src/css/Stylesheet.ts", "src/index.ts", "test/css/samples/cascade-false-empty-rule-dev/_config.js", "test/css/samples/cascade-false-empty-rule-dev/expected.css", "test/css/samples/cascade-false-empty-rule-dev/input.html", "test/css/samples/cascade-false-empty-rule/_config.js", "test/css/samples/cascade-false-empty-rule/expected.css", "test/css/samples/cascade-false-empty-rule/input.html"]
Compiler should warn on empty style block
Small thing, but when tidying up components this would be helpful [REPL](https://svelte.technology/repl?version=1.51.1&gist=b1fe8552385dbae6a8ca57f7f1c568ce) ```html <div class='foo'> no styles </div> <style> .foo { /* this should be warned about */ } </style> ```
https://github.com/sveltejs/svelte/issues/1138
https://github.com/sveltejs/svelte/pull/1149
29a156957fa0360046c11e5e66204df99e08f202
5b9f254087eb46196864949da9b37e6c4d55d780
2018-01-26T21:33:35Z
javascript
2018-02-07T13:08:23Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,132
["src/utils/createDebuggingComment.ts"]
await blocks fail when using CRLF line endings
Using the [await example from the repl](https://svelte.technology/repl?version=1.53.0&example=await-block) on windows (line endings CRLF) generates invalid javascript that webpack chokes on as you can see below. Changing the file to LF fixes the issue. <details> <summary>webpack stack trace</summary> ``` Module parse failed: Unexpected token (89:3) You may need an appropriate loader to handle this file type. | | // (4:19) <p>wait for it...</p> {{then answer}} | function create_pending_block(state, _, component) { | var p, text; | @ ./templates/.main.rendered.js 8:1630-1768 @ multi ./templates/.main.rendered.js style-loader/lib/addStyles css-loader/lib/css-base ``` </details>
https://github.com/sveltejs/svelte/issues/1132
https://github.com/sveltejs/svelte/pull/1134
9f088fe259aed9cdc92737661dc034b9b42adc75
935d4a2955eb8657509032ad527bc8a2ee8bee76
2018-01-25T15:48:13Z
javascript
2018-01-26T18:49:29Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,131
["src/generators/nodes/AwaitBlock.ts", "test/runtime/samples/await-set-simultaneous/_config.js", "test/runtime/samples/await-set-simultaneous/main.html"]
component.set doesn't update ui when called from an awaiting promise
Repro: https://svelte.technology/repl?version=1.53.0&gist=bfd178f583f0be414daadb871a1e18d6 As shown in the repl, when calling this.set at the end of the awaited promise's chain, it fails to update the ui. The second button with the setTimeout works (albeit with a flash).
https://github.com/sveltejs/svelte/issues/1131
https://github.com/sveltejs/svelte/pull/1150
37d526003643c54c4e8eb093604cce9a16d2e778
29a156957fa0360046c11e5e66204df99e08f202
2018-01-25T15:42:59Z
javascript
2018-02-04T14:09:01Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,127
["package.json", "test/runtime/index.js", "yarn.lock"]
Transition tests fail with latest jsdom
Couple of things going on here. When Rich cuts new builds, he (presumably) uses the dependencies as installed by Yarn, whereas CI uses npm and gets the latest versions of all dependencies. If the releases use Yarn, probably the CI jobs should too. There should probably also be an effort to update deps regularly, since they get bundled. The other issue here is that, with the latest version of jsdom (upgrade from 11.5.1 to 11.6.0), tests related to transitions fail. I believe this is partially/largely because of the change "Added a `window.performance` implementation, including the basics of the [High Resolution Time](https://w3c.github.io/hr-time/) specification: `performance.now()`, `performance.timeOrigin`, and `performance.toJSON()`." Indeed, if the hack in the tests is changed from `window.performance = { now: () => raf.time };` to `window.performance.now = () => raf.time;`, all but one of the tests pass (under the latest jsdom), although I'm not sure what this means.
https://github.com/sveltejs/svelte/issues/1127
https://github.com/sveltejs/svelte/pull/1128
c35eb67af2c91a84c4082c2882a29267bdd831c7
53217bd9a9f7c342c48b3f28c453124101a5605a
2018-01-25T00:22:12Z
javascript
2018-01-26T18:37:41Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,110
["src/validate/html/index.ts", "src/validate/html/validateElement.ts", "src/validate/html/validateHead.ts", "test/validator/samples/a11y-not-on-components/input.html", "test/validator/samples/a11y-not-on-components/warnings.json"]
Ignore a11y checks on child components
I just encountered an interesting "bug" of the a11y implementation. I have a component that uses scope as the prop name, and I get a warning that The scope attribute should only be used with <th> elements. I feel that a11y should be disabled on component definitions. Here's the full error (including code) ``` src/Components/Foo/index.html (20:71) A11y: The scope attribute should only be used with <th> elements 18: <div id="foo-id"> 19: <div class="foo-class"> 20: <Child scope="local"></Child> ^ 21: </div> 22: </div> ```
https://github.com/sveltejs/svelte/issues/1110
https://github.com/sveltejs/svelte/pull/1112
7bf743ca969cd585e0bbe0afdbe39450a11a7a9c
24ea1afe789aee74023b47523bad00feefb065e8
2018-01-15T22:01:21Z
javascript
2018-01-18T13:14:11Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,108
["src/generators/nodes/Element.ts", "test/runtime/samples/noscript-removal/_config.js", "test/runtime/samples/noscript-removal/main.html"]
<noscript> handling
Via https://github.com/sveltejs/sapper/issues/76. It probably makes sense just to ignore anything inside a `<noscript>` that's part of the template (except in SSR mode), since the fact that the component is rendering is proof that `<noscript>` doesn't apply.
https://github.com/sveltejs/svelte/issues/1108
https://github.com/sveltejs/svelte/pull/1160
90f6f660e762af36a511b2f8b5f6686c334ec4e3
a33dfe5bf3a00d5229f6e1c0513bc60a5bf3459c
2018-01-15T14:16:43Z
javascript
2018-02-09T13:24:05Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,107
["src/generators/server-side-rendering/index.ts", "test/runtime/samples/store-nested/Nested.html", "test/runtime/samples/store-nested/_config.js", "test/runtime/samples/store-nested/main.html"]
can't supply store to nested components server side
Hey, I'm trying to pass a store to a nested component which works well ordinarily, but it fails when server rendering it. E.g. I have a manage account page like so: ```html <div class="page"> <h1>Manage Account</h1> <div> <h3>Two Factor Auth</h3> <TwoFactorAuth /> </div> </div> <style> .page { width: 400px; margin: 50px auto; } </style> <script> import TwoFactorAuth from './_components/TwoFactorAuth'; export default { components: { TwoFactorAuth, }, } </script> ``` And in the TwoFactorAuth component, using a store via [svelte-redux](https://github.com/UnwrittenFun/svelte-redux) ```html {{#if $hasTwoFactor}} <div>yay its enabled</div> {{else}} <div>oh no its not enabled</div> {{/if}} <script> import { connect } from '../../_redux'; export default { store: connect(state => ({ hasTwoFactor: state.user && state.user.hasTwoFactor, })), } </script> ``` As mentioned this fails on the server side, but not when navigation to the page on the client side. I dug into the generated code a bit and I see it generates the template like so: ```js return `<div class="page" svelte-1782208320> <h1>Manage Account</h1> <div> <h3>Two Factor Auth</h3> ${__WEBPACK_IMPORTED_MODULE_0__components_TwoFactorAuth__["a" /* default */]._render(__result, {}, { store: options.store })} </div> </div>` ``` This is bypassing `render` where the store would be initialised ordinarily, and is instead just passing the parent store. It errors on the following line in the TwoFactorAuth's `_render` method, as the store is undefined ```js state = Object.assign(options.store._init(["hasTwoFactor"]), state); ``` ``` Cannot read property '_init' of undefined ```
https://github.com/sveltejs/svelte/issues/1107
https://github.com/sveltejs/svelte/pull/1116
8057884cb64f6c2cdf837411bc3962daf69e2bb5
7bf743ca969cd585e0bbe0afdbe39450a11a7a9c
2018-01-14T19:57:20Z
javascript
2018-01-18T13:12:44Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,100
["src/generators/nodes/Component.ts", "test/runtime/samples/store-component-binding/TextInput.html", "test/runtime/samples/store-component-binding/_config.js", "test/runtime/samples/store-component-binding/main.html"]
Component bindings can't access store
In an app with `store` support, any component can do this... ```html <input bind:value=$whatever> ``` ...but this doesn't work: ```html <Widget bind:x=$y/> ``` It just sets `$y` on the parent component, rather than setting `y` on the store.
https://github.com/sveltejs/svelte/issues/1100
https://github.com/sveltejs/svelte/pull/1153
db5cca9a07d419c913070e3a0f6f5034f0fc804d
e5e695928197b4ce5da01b82c1f6cd52baa109ea
2018-01-12T12:58:32Z
javascript
2018-02-09T15:04:52Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,079
["package.json", "src/generators/Generator.ts", "src/generators/dom/index.ts", "src/utils/annotateWithScopes.ts", "test/js/samples/deconflict-globals/expected-bundle.js", "test/js/samples/deconflict-globals/expected.js", "test/js/samples/deconflict-globals/input.html", "yarn.lock"]
Functions are available where they shouldn't be
[REPL](https://svelte.technology/repl?version=1.51.0&gist=1522933eead7976d67833a918f1843bd): ```html <script> export default { data: () => ({ foo: 'bar' }), oncreate() { alert(JSON.stringify(data())); } }; </script> ``` The reference to `data` in `oncreate` should imply the existence of a global `window.data` function, which means that Svelte should call the *actual* `data` function something else, like `data$1`. Tip o' the hat to @bm-stschneider
https://github.com/sveltejs/svelte/issues/1079
https://github.com/sveltejs/svelte/pull/1092
9cfa1747036607debd8502018681fa5697f1d5bf
ba770b69bc6d35caa58fd2128bc871d26f173131
2018-01-07T00:01:12Z
javascript
2018-01-11T14:07:52Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,071
["src/generators/nodes/Window.ts", "test/js/samples/window-binding-scroll/expected-bundle.js", "test/js/samples/window-binding-scroll/expected.js"]
Possible issue with binding back on <:Window> variables
See this REPL: https://svelte.technology/repl?version=1.50.1&gist=a2de5017bab2f388b03e81e91b41fbd9 Have to use indirection to set variables back on the window object. Discussion here: https://gitter.im/sveltejs/svelte?at=5a4ec8dc03838b2f2a70ce8d
https://github.com/sveltejs/svelte/issues/1071
https://github.com/sveltejs/svelte/pull/1072
6b956fb2bd96e94e5176fd1379ab0cf568ff1967
a3f59521215c881e5bbc32f4e83b332afc7793e2
2018-01-05T00:48:28Z
javascript
2018-01-06T21:45:47Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,067
["CHANGELOG.md", "src/runtime/internal/Component.ts", "src/runtime/internal/dom.ts"]
Hydration Re-Renders Entire DOM
When composing a simple example of a static ssr page with client-side hydration, the client code re-renders the entire DOM rather than just making in-place modifications. Each node seems to be removed and re-created. Example setup is here with mutation observers: https://github.com/distillpub/svelte-template GIF of the behavior in action below: ![hydrate](https://user-images.githubusercontent.com/418356/34500683-a644e1e4-efc0-11e7-9c5d-775a73aec76a.gif)
https://github.com/sveltejs/svelte/issues/1067
https://github.com/sveltejs/svelte/pull/6204
f322e3fba41cb4f67b34b389d039e8baeb9cba3a
10e3e3dae8dbd0bf3151c162949b8bf76dc62e8b
2018-01-02T21:28:02Z
javascript
2021-04-21T16:42:52Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,066
["src/generators/nodes/Element.ts", "src/generators/server-side-rendering/visitors/Text.ts", "src/utils/stringify.ts", "test/runtime/samples/html-entities-inside-elements/_config.js", "test/runtime/samples/html-entities-inside-elements/main.html", "test/server-side-rendering/samples/component-data-empty/_actual.html"]
HTML entities treated incorrectly
~~When compiling to custom elements~~, markup [like this](https://svelte.technology/repl?version=1.50.1&gist=ede18c4c99e716c26ecf5074a50645e2)... ```html <p>this should not be &lt;strong&gt;bold&lt;/strong&gt;</p> ``` ...is treated incorrectly — a `<strong>` element appears where none should. (edited: turns out this is nothing to do with custom elements)
https://github.com/sveltejs/svelte/issues/1066
https://github.com/sveltejs/svelte/pull/1073
70ce51df5c03f94a8603772ef70f6e49c9dcf4fa
521fd74e8bfb7e3b9dfc44570d6b0c55c85861b3
2018-01-02T15:13:27Z
javascript
2018-01-05T15:50:10Z
closed
sveltejs/svelte
https://github.com/sveltejs/svelte
1,065
["src/generators/dom/index.ts", "test/custom-elements/index.js", "test/custom-elements/samples/no-missing-prop-warnings/_config.js", "test/custom-elements/samples/no-missing-prop-warnings/main.html", "test/custom-elements/samples/no-missing-prop-warnings/test.js"]
Custom elements always get missing data warnings in dev mode
Because of the way custom elements work, if you have the traditional hello world component... ```html <h1>Hello {{name}}!</h1> <script> export default { tag: 'my-app' }; </script> ``` ...and create it like so... ```js document.body.innerHTML = `<my-app name='world'/>`; ``` ...then at the time of creation, the `name` property is unpopulated (the callback fires immediately after construction). In dev mode, this means you get incorrect warnings about missing properties.
https://github.com/sveltejs/svelte/issues/1065
https://github.com/sveltejs/svelte/pull/1154
f606aee20917d717cdeaecc5f0a15ed97b08b047
25b1f05ee824311efd9ff4c7cb3792d073a27dce
2018-01-02T04:10:01Z
javascript
2018-02-09T13:38:44Z