Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed unnecessarily style properties update #3439

Merged
merged 1 commit into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default class StyleAttributeWrapper extends AttributeWrapper {
} else {
const snippet = chunk.render();

add_to_set(prop_dependencies, chunk.dependencies);

add_to_set(prop_dependencies, chunk.dynamic_dependencies());
return chunk.get_precedence() <= 13 ? `(${snippet})` : snippet;
}
})
Expand Down
47 changes: 47 additions & 0 deletions test/js/samples/inline-style-without-updates/expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* generated by Svelte vX.Y.Z */
import {
SvelteComponent,
detach,
element,
init,
insert,
noop,
safe_not_equal,
set_style
} from "svelte/internal";

function create_fragment(ctx) {
var div;

return {
c() {
div = element("div");
set_style(div, "color", color);
},

m(target, anchor) {
insert(target, div, anchor);
},

p: noop,
i: noop,
o: noop,

d(detaching) {
if (detaching) {
detach(div);
}
}
};
}

let color = 'red';

class Component extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, []);
}
}

export default Component;
5 changes: 5 additions & 0 deletions test/js/samples/inline-style-without-updates/input.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script>
let color = 'red';
</script>

<div style="color: {color}"></div>