Skip to content

Commit

Permalink
Merge pull request #2618 from EmilTholin/remove_21618scope_from_spread
Browse files Browse the repository at this point in the history
Remove the $$scope key from $$props when calculating spread
  • Loading branch information
Rich-Harris authored May 4, 2019
2 parents 6240ed0 + 5a0be42 commit c217f2b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internal/spread.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function get_spread_update(levels, updates) {
const update = {};

const to_null_out = {};
const accounted_for = {};
const accounted_for = { $$scope: 1 };

let i = levels.length;
while (i--) {
Expand Down Expand Up @@ -34,4 +34,4 @@ export function get_spread_update(levels, updates) {
}

return update;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<slot />
<div {...$$props}></div>
</div>
19 changes: 19 additions & 0 deletions test/runtime/samples/component-slot-spread-props/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export default {
html: `
<div>
<input />
<div class="foo"></div>
</div>
`,

async test({ assert, component, target }) {
component.value = 'foo';

assert.htmlEqual(target.innerHTML, `
<div>
<input />
<div class="foo"></div>
</div>
`);
}
};
8 changes: 8 additions & 0 deletions test/runtime/samples/component-slot-spread-props/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
import Nested from './Nested.svelte';
export let value = '';
</script>

<Nested class="foo">
<input bind:value />
</Nested>

0 comments on commit c217f2b

Please sign in to comment.